【问题标题】:Why is the padding on my section element not working?为什么我的部分元素上的填充不起作用?
【发布时间】:2015-10-08 08:54:57
【问题描述】:

我正在构建一个 WordPress 网站并使用 Bootstrap。我正在尝试向我的sections 添加填充,但它不起作用。在检查器中,它旁边有黄色三角形感叹号,我不知道为什么。这是我的 CSS:

#stats {
    padding: 36px auto !important;
}

还有我的 HTML:

<section id="stats">
   <div class="container">
      <div class="row">
         <div class="col-sm-8">
            <h4>This is an infographic</h4>
         </div>
         <div class="col-sm-4">
            <p>This is some supporting text</p>
         </div>
      </div>
   </div>
</section>

Bootstrap 中有什么东西可以防止这种情况发生吗?这是检查员的屏幕截图:

【问题讨论】:

  • 我找到了一种解决方法,但我仍然想知道为什么这不起作用。我的解决方法是将margin-topmargin-bottom 添加到孩子.container

标签: html css wordpress twitter-bootstrap


【解决方案1】:

auto 不是 padding 属性的有效值。如果您想使用auto,请使用margin,或者坚持使用pxpadding 值。

【讨论】:

    猜你喜欢
    • 2011-11-02
    • 2021-12-20
    • 2012-08-30
    • 1970-01-01
    • 2016-08-09
    • 1970-01-01
    • 2017-04-30
    • 2016-02-08
    • 2022-12-10
    相关资源
    最近更新 更多