overflow-y滚动条不起作用
.overflow {
width:80%;
margin-left:10%;
height: 300px;
overflow-y: auto;
background: #333;
color: #fff;
}
.divwidth {
width:100px;
height: 30px;
background: #666;
position: absolute;
margin-left: -25px;
}
答案 0 :(得分:0)
试试这个:您可以从position: absolute;
类文件
.overflow
.overflow {
width:80%;
margin-left:10%;
height: 300px;
overflow-y: auto;
background: #333;
color: #fff;
position: absolute;
}
.divwidth {
width:100px;
height: 30px;
background: #666;
position: relative;
}
OR
.overflow {
width:80%;
margin-left:10%;
height: 300px;
overflow-y: auto;
background: #333;
color: #fff;
position: relative;
}
.divwidth {
width:100px;
height: 30px;
background: #666;
position: absolute;
margin-left: -25px;
}
答案 1 :(得分:0)
所以如果你把它添加到溢出的那个
.overflow {
position: relative;
width:80%;
margin-left:10%;
height: 300px;
overflow-y: auto;
background: #333;
color: #fff;
}
这样,内部div的绝对尺寸将限制在此div