我们需要位置 Phone
、Name
和 Firstname
到左边,button
到右边。我尝试使用 float-left
和 float-right
,第一行可以吗,但之后就更复杂了。
对于第二行,我尝试使用 row
+col-1..
但 Phone
、Name
和Firstname
未与 input
+--------------------------------------------------------------------------------+
| Title | button | |
+------------+-------------------------------------------------------------------+
| Phone | input | Name | input | Firstname | input | | button | |
+------------+-------------------------------------------------------------------+
| Content table |
| |
| |
| |
| |
| |
| |
| |
| |
| |
+--------------------------------------------------------------------------------+
最佳答案
你试过了吗flexbox ?
Bootstrap 示例 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>
关于HTML&CSS + Twitter Bootstrap : any form element to left and button to right (row section),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55058513/