我已经被这个简单的问题困扰了一段时间.它可能是复制品,但我在网上找不到类似的问题.
我正在try 将绿色条的高度设置为100%(以便与红色的家长具有相同的高度).
如果有帮助的话,这里有一个代言人:https://codepen.io/tartie2/pen/NWYZpgj
以下是代码:
div {
background-color:red;
height:200px;
width:300px;
position: relative;
overflow: auto;
}
div::after{
content: '';
position:absolute;
top: 0;
left: 0;
min-height: 100%;
width:10px;
background-color: green;
}
<div>
<h1>hello</h1>
<h1>hello</h1>
<h1>hello</h1>
<h1>hello</h1>
<h1>hello</h1>
<h1>hello</h1>
<h1>hello</h1>
<h1>hello</h1>
<h1>hello</h1>
</div>