margin-bottom无法使用基于百分比的高度

时间:2013-10-05 13:28:58

标签: css

我无法将 margin-bottom 属性添加到已拉伸以匹配浏览器高度的元素。例如:

HTML

<body>
    <section></section>
</body>

CSS

  html, body {
      height: 100%;
      min-height: 100%;
      background-color: #FFF;
  }
  section {
      height: 100%;
      min-height: 100%;
      margin-bottom: 50%;
      background-color: #000;
  }

像素和百分比值都不能扩展margin-bottom属性。

附件是一个解释我的问题的方法:margin-bottom problem

谢谢!

1 个答案:

答案 0 :(得分:1)

工作正常。

只需添加另一个

<section></section> 

查看保证金

<body>
<section>hello</section>
<section>yo</section>
</body>