【发布时间】:2019-09-07 18:55:39
【问题描述】:
height: 100% 是如何在 .rel div 上实际工作的? 我确信相对 div 过去从未考虑过百分比高度...
.box{
width: 200px;
height: 200px;
}
.rel{
position: relative;
width: 100%;
height: 100%;
border: 1px solid red;
}
a{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 60px;
}
b{
position: absolute;
left: 0;
bottom: 0;
width: 100%;
}
<div class="box">
<div class="rel">
<a> aa </a>
<b> bb </b>
</div>
</div>
【问题讨论】:
-
一直运行良好。甚至可以在 IE6 中运行。
标签: css height css-position