【问题标题】:why the width of col in bootstrap include padding为什么引导程序中 col 的宽度包括填充
【发布时间】:2015-11-12 10:07:10
【问题描述】:

根据 W3school,高度和宽度不包括填充和边距,但是,在引导程序中,col--,假设 col-md-3 将设置宽度 = 25 %,但这包括填充,为什么?

<div class="text-center">
<div class="row">
    <div class="col-md-4">
        <div class="well">.col-md-4</div>
    </div>
    <div class="col-md-4">
        <div class="well">.col-md-4</div>
    </div>
    <div class="col-md-4">
        <div class="well">.col-md-4</div>
    </div>
</div>
</div>

每列的宽度是33.33%*行的宽度=436.67px,

the width of col

the layout of col

根据每个col的布局,我们可以看到实际的width(436.67px) =padding + content的宽度。我认为内容宽度应该是 436.67px?为什么我错了?

【问题讨论】:

    标签: css web twitter-bootstrap-3


    【解决方案1】:

    在引导 css 中有一条规则:

    * {
        box-sizing: border-box;
    }
    

    根据该规则,width 使用content width + border + padding 计算。见this article

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-18
      • 2015-05-13
      • 2011-06-09
      • 2017-08-17
      • 2015-03-14
      • 2015-06-23
      • 1970-01-01
      • 2011-11-10
      相关资源
      最近更新 更多