css实现图片横向排列滚动

时间:2023-03-08 21:32:52
css实现图片横向排列滚动
.imageList{
overflow-x: auto;
overflow-y: hidden;
height:180px;
white-space: nowrap;
img{
width:auto;
height:100%;
margin-right:10px;
}
}
<div class="imageList">
<img src="1.jpg"/>
<img src="2.jpg"/>
<img src="3.jpg"/>
<img src="4.jpg"/>
<img src="1.jpg"/>
</div>

css实现图片横向排列滚动

这里注意,img标签不能左浮动,外层容器必须加不换行

white-space: nowrap;