【发布时间】:2020-11-05 23:05:38
【问题描述】:
我想将“背景”div 的高度设置为其父级的 100%,即使它大于视口,如
<!DOCTYPE html>
<html style="height:100%; margin:0; padding:0">
<body style="height:100%; margin:0; padding:0">
<div style="height:2000px; margin:0; padding:0; background-color:red">
// Background div.
<div style=" position:absolute; top:0; height:100%; width:100%; min-width:100%; background-color:blue">
</div>
// More divs with content on top.
</div>
</body>
</html>
这应该很简单,但我还没有找到任何方法(在 Firefox 和 Chrome 中测试过)?
【问题讨论】: