twitter-bootstrap - 使用 Bootstrap 在两列中显示复选框

标签 twitter-bootstrap css

我使用 Bootstrap 在两列中显示复选框。简短示例:

<fieldset class="col-lg-6 col-md-12">
   <label>
      <input type="checkbox" />
      <span>Here is the text</span>
   </label>
</fieldset>

这是一张图片 the checkboxes in two columns在图像中,您可以看到“交通”复选框比其他复选框低得多。

在某些屏幕尺寸下,如何防止复选框之间出现空白? 我无法更改显示标签及其内部范围的方式,但我可以向它们添加类。

最佳答案

您只需添加此 CSS:

ul {
  column-count: 2;
  column-gap: 2rem;
  list-style: none;
}

对 HTML 进行了一些更改

<div class = "container">
  <div class="row">
    <div class="col-12">
      <ul>

       <li>
          <label>
            <input type="checkbox" />
            <span>Here is the text</span>
          </label>
       </li>

       <li>
          <label>
            <input type="checkbox" />
            <span>Here is the text</span>
          </label>
       </li>

       <li>
          <label>
            <input type="checkbox" />
            <span>Here is the text</span>
          </label>
       </li>

       <li>
          <label>
            <input type="checkbox" />
            <span>Here is the text</span>
          </label>
       </li>

       <li>
          <label>
            <input type="checkbox" />
            <span>Here is the text</span>
          </label>
       </li>



       </ul>
    </div>
  </div>
</div>

关于twitter-bootstrap - 使用 Bootstrap 在两列中显示复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42108219/

相关文章:

html - EM 中的宽度不符合我的预期

css - 使jqm可折叠透明

html - 背景图像未出现在移动设备上

html - bootstrap 崩溃以显示它工作的 div 但如何使其不影响副元素?

php - 我怎样才能加快 Bootstrap 工具提示

css - SVG 作为数据 URI 在 Firefox 中触发 XML 解析错误

javascript - jquery中如何监听某个元素是show()还是hide()?

css - Angularjs - 导航栏下拉菜单在用户界面布局中重叠

twitter-bootstrap - 从Grails Controller 调用Bootstrap弹出窗口

css - 围绕居中的品牌形象包装 Bootstrap 导航栏列表项