【问题标题】:iOS Checkboxes using bootstrap won't center使用引导程序的 iOS 复选框不会居中
【发布时间】:2016-02-15 09:30:35
【问题描述】:

由于 WebKit 样式,我正在努力让复选框在 iOS 上正确居中。我正在使用引导程序来创建响应式设计。

这是我的代码被 iOS 破坏的结果:

我正在使用以下代码:

<div class="form-group">
    <label class="control-label col-xs-5 col-sm-2" for="formatA">Format:</label>
    <div class="col-xs-3 col-sm-2">
        <input type="checkbox" class="form-control" id="formatA" name="formatA">
    </div>
    <div class="col-xs-4 col-sm-4">
        <input type="date" class="form-control" id="formatD" name="formatD" placeholder="Enter date of format approval">
    </div>
</div>

【问题讨论】:

  • 如果垂直居中问题是 iOS 独有的,请在复选框上尝试 -webkit-appearance: none。
  • 问题是水平居中,对不起,我应该更清楚,我会更新我的问题。我已经尝试过您的解决方案,它只是使复选框的行为非常奇怪。谢谢。

标签: html ios css twitter-bootstrap checkbox


【解决方案1】:

好的,所以我已经用解决方案做了一个 plunker。我再次查看了引导网格语法,有点发现您布局网格的方式可能存在一些问题。我又从头开始了,这就是我想出的

http://plnkr.co/edit/x3vDfl15LA2yxxDOeUQT

<div class="container-fluid">
      <div class="row">
        <div class="col-xs-4">
          <label class="control-label" for="formatA">Format:</label>
        </div>
        <div class="col-xs-4">
          <input type="checkbox" class="" id="formatA" name="formatA" />
        </div>
        <div class="col-xs-4">
          <input type="date" class="form-control" id="formatD" name="formatD" placeholder="Enter date of format approval" />
        </div>
      </div>
    </div>

css

html{
      font-size: 16px;
    }
    input[type="checkbox"]{
      display:block;
      margin:0 auto;
      padding: 20px;
    }
    input[type="date"]{
      width:100%;
    }

这让我在我的 iPhone 6+ 上得到了这个结果 iphone6

【讨论】:

  • 不幸的是,这似乎没有效果,它们仍然保持在左侧对齐
  • 哦,尝试为复选框添加宽度,例如 50 像素或其他东西,我会更改答案以反映
  • 仍然没有效果,只是将页面推得更宽,但对复选框本身没有影响。这是因为苹果严格的 webkit 样式。
  • k 我会做更多的研究。
  • 谢谢,我这几天断断续续地挣扎,我一直在放弃,认为它可以保持这样,但我的完美主义者不会允许它哈哈。跨度>
猜你喜欢
  • 2019-09-02
  • 2016-06-20
  • 2018-11-14
  • 1970-01-01
  • 1970-01-01
  • 2014-07-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多