我正在使用flex:0 0 auto;在CSS和一些瀏覽器中,div之間有1px的差距。
body {
overflow: hidden;
position: relative;
height: 100vh;
width: 100vw;
background-color: black;
}
.scrollWrapper {
position: relative;
overflow-x: hidden;
overflow-y: scroll;
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
}
.scrollWrapper > * {
background-color: white;
height: 10%;
width: 100%;
flex: 0 0 auto;
}
<div class="scrollWrapper">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>