【发布时间】:2014-12-03 15:09:46
【问题描述】:
任何人都知道如何防止与动态宽度相等的高度 div 与下面的内容重叠。 div 需要扩展以包含狭窄视口中的内容。
@caeth 建议将下面的 div 移动到上面的 div 中,这很有效:http://jsfiddle.net/534k9e2n/5/ 但我正在寻找不需要这个的解决方案。
代码如下:
<div class="holder">
<div class="shape"></div>
<div class="shape_outer">
<div class="shape_inner">Content...</div>
</div>
</div>
<div class="shape_below"></div>
...
.holder {
display: inline-block;
position: relative;
width: 50%;
}
.shape {
margin-top: 100%;
}
.shape_outer {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.shape_inner {
background: #ddd;
min-height: 100%;
width: 100%;
}
.shape_below {
background: #111;
width: 200px;
height: 200px;
}
还有一个 JSFiddle:http://jsfiddle.net/534k9e2n/4/
谢谢 B。
【问题讨论】:
标签: html css fluid-layout