我有一个包裹着一些子元素的wraper div
。由于所有子元素的高度加起来比wrapper div
的高度还高,我想让父元素能够滚动。
以下解决方案在Chrome中有效,但在Edge,IE和Firefox中无效。我已经尝试了不同的方法,但我的解决方案似乎都不能跨不同浏览器工作。是否有任何可以在不同浏览器上工作的解决方案?
#wrapper {
display: flex;
flex-direction: column-reverse;
background-color: green;
width: 300px;
height: 300px;
overflow-y: scroll;
}
.inner {
background-color: red;
height: 100px;
width: 100px;
margin-top: 10px;
min-height: 100px;
}
<div id="wrapper">
<div class="inner">hello</div>
<div class="inner">hello</div>
<div class="inner">hello</div>
<div class="inner">hello</div>
<div class="inner">hello</div>
<div class="inner">hello</div>
</div>