代码之家  ›  专栏  ›  技术社区  ›  Stéphane GRILLON

HTML&CSS+Twitter引导:任何表单元素位于左侧,按钮位于右侧(行部分)

  •  0
  • Stéphane GRILLON  · 技术社区  · 7 年前

    我们需要位置 Phone , Name ,和 Firstname 向左和 button 向右。我试着 float-left float-right ,第一排可以吗,但之后会更复杂。 对于第二排,我尝试使用 row + col-1.. 电话 姓名 ,和 未与 input

      +--------------------------------------------------------------------------------+
      |  Title                                                              | button | |
      +------------+-------------------------------------------------------------------+
      |  Phone | input |    Name | input |    Firstname | input |           | button | |
      +------------+-------------------------------------------------------------------+
      |  Content table                                                                 |
      |                                                                                |
      |                                                                                |
      |                                                                                |
      |                                                                                |
      |                                                                                |
      |                                                                                |
      |                                                                                |
      |                                                                                |
      |                                                                                |
      +--------------------------------------------------------------------------------+
    
    0 回复  |  直到 7 年前
        1
  •  1
  •   Cichy    7 年前

    你试过了吗 flexbox ?

    示例 引导 auto margins

    <nav class="navbar">
      <form class="form-inline w-100 d-flex">
        <div class="form-group mr-4">
          <label for="field-1"class="mr-2">Field #1</label>
          <input class="form-control" id="field-1">
        </div>
    
        <div class="form-group mr-4">
          <label for="field-1"class="mr-2">Field #2</label>
          <input class="form-control" id="field-2">
        </div>
    
        <button class="btn btn-success ml-auto">Button</button>
      </form>
    </nav>
    

    现场示例 https://jsfiddle.net/cichy380/5svek2xn/

        2
  •  0
  •   aviralar    7 年前