我想在不滚动标题的情况下将滚动条应用于子div
我尝试过
overflow-y:auto and overflow-y:scroll
但它们都不起作用
我的主要div高度为500px,我给我的孩子div设置高度为200px,如果我的孩子div的高度超过200px并修复了标头,而我的下面的CSS没有得到应用,我需要应用滚动
<div style="padding:20px; max-height:500px;overflow-y:auto" id="divMain">
<div style="padding:20px; max-height:200px;overflow-y:auto" id="childdiv1">
</div>
<div style="padding:20px; max-height:200px;overflow-y:auto" id="childdiv2">
</div>
<div style="padding:20px; max-height:200px;overflow-y:auto" id="childdiv3">
</div>
<div style="padding:20px; max-height:200px;overflow-y:auto" id="childdiv4">
</div>
</div>
答案 0 :(得分:0)
<div class="container">
<div class="col1" >
Mycontent 1
</div>
<div class="col2" >
Mycontent 2
</div>
</div>
.container {
height: 300px;
width: 35%;
overflow-x: hidden;
overflow-y: scroll;
position: relative;
padding-bottom: 30px;
}
.col1 {
height: 500px;
width: 300px;
position: relative;
float: left;
}
.col2 {
height: 500px;
width: 300px;
position: relative;
float:right;
}
enter code here