我一直试图让我的图像在同一条线上彼此相邻,如果需要,只需将它们裁剪成更小的尺寸。为什么不起作用object-fit
?
HTML:
<div class="gallery">
<div class="inner"><img src="images/image1.jpg"></div>
<div class="inner"><img src="images/image2.jpg"></div>
<div class="inner"><img src="images/image3.jpg"></div>
</div>
CSS:
.gallery{
width: 1000px;
height: 300px;
display: flex;
}
.inner{
width: 333px;
height: 300px;
}
.inner img{
object-fit: contain;
}