我正在尝试使用相对固定的 div 中的 CSS 列以类似列的方式排列图像。我希望 div 垂直滚动,但是当它达到可用的最大垂直空间时,它会在右侧创建新列,迫使 div 水平滚动,而不是保持 3 个预期的列并垂直溢出。关于如何解决它的任何想法?
body {
background-color: white;
width:100%;
height:100%;
position:absolute;
font-family: "ff-tisa-web-pro",serif;
font-size: 16px;
font-weight: 400;
line-height: 1.45;
color: #333;
background: rgba(200,125,06,0.5)
}
.grid {
position:relative;
height:80%;
-webkit-columns: 150px;
-moz-columns: 3 150px;
columns: 3 150px;
width:40%;
margin:auto;
overflow: auto;
background: rgba(200,125,06,0.5);
break-inside: avoid;
}
.grid img{
width:100%;
}
<div class="grid">
<img src="http://i.telegraph.co.uk/multimedia/archive/03434/guinness-eyeballs_3434500k.jpg"/>
<img src="https://www.allindiaroundup.com/wp-content/uploads/2015/01/mr-bean-pics-as-a-baby-whatsapp-dp-1024x768.jpg"/>
<img src="http://www.likecool.com/Gear/Pic/10%20Vintage%20Pics%20Of%20Carrie%20Fisher%20Promoting%20%20Return%20Of%20The%20Jedi%20%20In/10-Vintage-Pics-Of-Carrie-Fisher-Promoting--Return-Of-The-Jedi--In-2.jpg"/>
<img src="http://8.mshcdn.com/wp-content/uploads/2012/10/steve-jobs-finger.jpg"/>
<img src="https://www.funnypica.com/wp-content/uploads/2012/05/funny-picture-of-ugly-indian.jpg"/>
<img src="http://i.telegraph.co.uk/multimedia/archive/03434/guinness-eyeballs_3434500k.jpg"/>
<img src="https://www.allindiaroundup.com/wp-content/uploads/2015/01/mr-bean-pics-as-a-baby-whatsapp-dp-1024x768.jpg"/>
<img src="http://www.likecool.com/Gear/Pic/10%20Vintage%20Pics%20Of%20Carrie%20Fisher%20Promoting%20%20Return%20Of%20The%20Jedi%20%20In/10-Vintage-Pics-Of-Carrie-Fisher-Promoting--Return-Of-The-Jedi--In-2.jpg"/>
<img src="http://8.mshcdn.com/wp-content/uploads/2012/10/steve-jobs-finger.jpg"/>
<img src="https://www.funnypica.com/wp-content/uploads/2012/05/funny-picture-of-ugly-indian.jpg"/>
</div>