html - 在 Form-Inline 中对齐标签和文本框

标签 html css twitter-bootstrap

我正在使用 Bootstrap 的网格系统并想创建一个内联表单。

这是我的:

<div class="container body-content">

  <form class="well form-inline" style="width: 100%;">

    <div class="row">
        <div class="form-group col-md-4">
          <label>Location:</label>
          <input type="text" class="form-control">
        </div>


        <div class="form-group col-md-4">
          <label>Assignment:</label>
          <input type="text" class="form-control">
        </div>

        <div class="form-group col-md-4">
          <label>Incident Number:</label>
          <input type="text" class="form-control">
        </div>
    </div>

    <br>
    <br>

    <div class="row">
        <div class="form-group col-md-4">
          <label>Date:</label>
          <input type="text" class="form-control">
        </div>

        <div class="form-group col-md-4">
          <label>Training:</label>
          <input type="text" class="form-control">
        </div>

        <div class="form-group col-md-4">
          <label>Example:</label>
          <input type="text" class="form-control">
        </div>
    </div>

</form>

</div>

运行时,文本框或标签没有结构或对齐方式。我怎样才能做到这一点?

Here is a bootply

最佳答案

对于每个标签和输入,你应该制作这个结构:

<div class="form-group col-md-4">
     <label class="col-lg-4 control-label">Location:</label>
     <div class="col-lg-8">
          <input type="text" class="form-control">
     </div> 
</div>

这将使它与网格系统一起工作

See bootply

关于html - 在 Form-Inline 中对齐标签和文本框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43614516/

相关文章:

html - 固定宽度的行,动态大小的列,断行换行

php - 在 Twig 循环中具有父类的图库算法

javascript - bootstrap-switch - 切换时触发事件

javascript - 在javascript中将百分比转换为颜色

css - 缩放元素以适合浏览器窗口

html - 你如何对齐输入文本?

jquery - Twitter Bootstrap 警报可以淡入淡出吗?

javascript - 我的测验应用程序无法运行

html - 什么是 css/html `root` 元素?

html - Angular ng-if 更改跨度文本