【问题标题】:Bootstrap inline-form one element pushing label to leftBootstrap内联形式一个元素将标签向左推
【发布时间】:2015-05-15 18:09:08
【问题描述】:

这是它的渲染方式(在 chrome 中)http://i.imgur.com/aQS5j5r.png

我想做两件事:

让我的公司下拉标签像其他人一样移到顶部,然后将搜索框和公司下拉标签与其余字段内联。

这不是空间问题(或者至少我认为不是)。如果我删除公司下拉列表和联系人姓名之外的所有表单元素,我会得到相同的行为。

生成的代码:

<form action="/TicketViewer" method="post" class="form-inline">
    <div class="form-group">
        <label for="inquiryID">Inquiry ID</label>
        <input type="text" class="form-control" id="inquiryID" name="inquiryID" placeholder="e.g. 7-2931">
    </div>
    <div class="form-group">
        <label for="contactName">Contact Name</label>
        <input type="text" class="form-control" id="contactName" name="contactName" placeholder="e.g. gavin (case insensitive) ">
    </div>
    <div class="form-group">
        <label for="searchKeyword">Search Keyword</label>
        <input type="text" class="form-control" id="searchKeyword" name="searchKeyword" placeholder="e.g. added mailbox (case insensitive)">
    </div>
    <div class="form-group">
        <label for="selectedCompany">Company</label>
        <select class="form-control" id="SelectedCompany" name="SelectedCompany"><option value=""></option>
<option>SNIPPED</option>
</select>
    </div>
    <div class="form-group">
        <label for="sel1">Engineer</label>
        <select class="form-control" id="engineer" name="engineer">
            <option value="" default selected>All Engineers</option>
            <option>REDACTED LIST/option>
        </select>
    </div>
    <button type="submit" class="btn btn-default">Search</button>
</form>

【问题讨论】:

  • 这不是纯引导程序,是吗?你有这段代码的 CSS 吗?
  • 我们能看到一些 CSS 吗?只有你的 HTML 看起来不错。见link
  • 您希望我发布哪些元素?刚刚尝试在标签后添加
    并正确对齐 - 这有助于诊断吗?
  • 可能有一些 CSS 干扰了 Bootstrap CSS。检查浏览器中的.form-grouplabelselect 元素,看看是否有任何发现。

标签: css twitter-bootstrap twitter-bootstrap-3


【解决方案1】:

也许最好使用引导网格布局来显示表单: http://getbootstrap.com/css/#grid 您可以在其中使用嵌套网格实现此布局。这是一个例子

<div class="col-sm-3">
   <div class="row">
      <div class="col-sm-12">text</div>
   </div>
   <div class="row">
      <div class="col-sm-12">textbox</div>
   </div>
</div>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-18
    • 2020-01-25
    • 2021-07-07
    • 1970-01-01
    相关资源
    最近更新 更多