我有一个固定高度为 500px 的 div。包含在 div 中的是图像。我已经让它们以我目前喜欢的方式堆叠和溢出,但是当可见 div 完全填充到底部并向下滚动时,我如何强制 div 在 x 轴上滚动。这是我当前的 HTML 和 SCSS
<div class="gallery">
<img src="img/samples/sample-photo-1.jpg" class="wedding" />
<img src="img/samples/sample-photo-2.jpg" class="portraights" />
<img src="img/samples/sample-photo-2.jpg" class="family" />
<img src="img/samples/sample-photo-1.jpg" class="wedding" />
<img src="img/samples/sample-photo-1.jpg" class="wedding" />
<img src="img/samples/sample-photo-2.jpg" class="portraights" />
<img src="img/samples/sample-photo-2.jpg" class="family" />
<img src="img/samples/sample-photo-2.jpg" class="portraights" />
<img src="img/samples/sample-photo-2.jpg" class="family" />
</div>
.gallery {
clear: both;
margin: 0 0 0 15px;
max-height: 500px;
width: 100%;
overflow-x: scroll;
display: block;
img {
float: left;
padding: 3px;
}
}