【发布时间】:2020-02-09 11:09:54
【问题描述】:
如何在没有指定父高度的情况下将侧边栏 div 拉伸到 100% 高度?
不能使用父高度的原因是因为内容区域是动态的。使用高度只会剪切我的div内容。
这是我所做的:
.left {
width: 70%;
float: right;
background: green;
padding-right:5px;
box-sizing: border-box;
}
.right {
width: 30%;
float: right;
background: yellow;
height:100%;/*doesn't stretch*/
}
【问题讨论】:
-
你不能。
height百分比相对于父级的height。