将内容保留在bootstrap中的一行中

时间:2017-02-18 04:37:14

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

如何将以下内容保留在一行

<div class="row">
<div class="col-md-12">
    <div class="form-check form-check-inline">
        <label class="form-check-label">
            <input class="form-check-input" type="checkbox" id="inlineCheckbox1" value="option1">
            Item<asp:TextBox ID="TextBox1" CssClass="form-control input-sm" runat="server"></asp:TextBox>
        </label>
    </div>
</div>

1 个答案:

答案 0 :(得分:1)

nowrap类添加到容器中,以查找要在同一行上的元素,然后将此.nowrap类添加到CSS中。

&#13;
&#13;
.nowrap {
  white-space: nowrap;
}
&#13;
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
  <div class="col-md-12">
    <div class="form-check form-check-inline nowrap">
      <label class="form-check-label">
        <input class="form-check-input" type="checkbox" id="inlineCheckbox1" value="option1"> Item
        <asp:TextBox ID="TextBox1" CssClass="form-control input-sm" runat="server"></asp:TextBox>
      </label>
    </div>
  </div>
&#13;
&#13;
&#13;