css - 如何居中 Bootstrap 复选框表单

标签 css twitter-bootstrap twitter-bootstrap-3

I need to center this checkboxes 谁能帮我把这个复选框居中?我已经尝试了很多东西。

这是我的代码:

  <div class="row checkbox-row">
              <div class="col-sm-6">
                <div class="checkbox-inline">
                  <label class="checkbox-inline"><input type="checkbox" value="">Adult News</label>
                </div>
              </div>
              <div class="row checkbox-row">
                <div class="col-sm-6">
                  <div class="checkbox-inline">
                    <label class="checkbox-inline"><input type="checkbox" value="">Youth News</label>
                  </div>
                </div>
              </div>
            </div>

最佳答案

这样的事情怎么样? https://jsfiddle.net/sxh0n7d1/20/

由于 bootstrap 行位于 12 列网格中,我选中了每个跨越 2 列的复选框,并将 4 列向右移动 4。

<div class="row checkbox-row">
  <div class="col-xs-2 col-xs-offset-4">
    <div class="checkbox-inline">
      <label class="checkbox-inline">
        <input type="checkbox" value="">Adult News</label>
    </div>
  </div>
  <div class="row checkbox-row">
    <div class="col-xs-2">
      <div class="checkbox-inline">
        <label class="checkbox-inline">
          <input type="checkbox" value="">Youth News</label>
      </div>
    </div>
  </div>
</div>

关于css - 如何居中 Bootstrap 复选框表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39173271/

相关文章:

css - 文本溢出 : ellipsis doesn't appear to be working

css - Twitter Bootstrap : Nested fieldsets?

php - Bootstrap 事件列表/文本对齐

jquery - 如何消除 Bootstrap 模态背景的淡出

css - pygments + Bootstrap : highlight shell code with dark background

html - Bootstrap 文本输入高度

html - 如何绝对定位HTML中文本的基线

jquery - 侧边栏垂直菜单 : item collapses when sub-item is clicked

html - 如何在 sm 显示器上跨越 2 行的 bootstrap 4 表单行中的字段之间留出边距?

html - 在列表组 block 中显示内联元素