作者:玄天战猫 | 来源:互联网 | 2023-05-25 17:32
使用绝对值时,它会滚动但不会达到100%的高度:
.class {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
height: 100%;
width: 100%;
z-index: 1000000;
background: rgba(0, 0, 0, 0.9);
}
固定后,它的高度为100%,但不会滚动
.class {
position: fixed;
left: 0;
top: 0;
height: 100%;
width: 100%;
z-index: 1000000;
background: rgba(0, 0, 0, 0.9);
}
我想避免在子元素中添加固定的高度并制作它 overflow: scroll
1> Joseph Marik..:
您需要添加overflow:auto
以便在内容溢出容器时滚动它.
.class {
...
overflow:auto;
}
http://jsbin.com/kuqaqumude/1/edit?html,css,output
如对更多的细节overflow: auto
和overflow: visible
,
请参见:
http://www.w3.org/TR/CSS21/visufx.html#overflow-clipping