如何将高度设置为元素的100%,位置固定取决于其包装高度



这里是小提琴链接

.homeFirstSection {
float: left;
width: 100%;
height: 500px;
position: relative;
}
.home_left_bar {
float: left;
background: #f67777;
width: 4%;
height: 100%;
z-index: 5;
position: fixed;
 }

如何将固定部分的高度设置为其换行高度?

找到了一个非常简单的解决方案,只设置css的高度来继承。这里是提琴和代码

.homeFirstSection {
float: left;
width: 100%;
height: 200px;
position: relative;
}
.home_left_bar {
float: left;
background: #f67777;
width: 4%;
height: inherit;
z-index: 5;
position: fixed;
}

最新更新