我有一些问题与CSS为我的网页,显示社会媒体风格的帖子,包括图像。当显示图像时,它们被放置在div标记中,该标记的样式是尝试缩小图像的大小,并将图像horziont地相邻显示。
然而,我有一个问题,图像仍然试图堆叠在一起,我不能让他们调整我想要的大小,特别是在移动。目前基于其他线程,这是我得到的
.postImg{
display: inline-block;
height:100%;
width:100%;
object-fit: scale-down;
}
.postImgDiv{
height: 100px;
}
您的图像取行宽度的100%。将其更改为:widty:auto
。
看看这个(你的案例):
null
.postImg{
display: inline-block;
height:100%;
width:100%;
object-fit: scale-down;
border: 1px solid;
}
.postImgDiv{
height: 100px;
}
<div class="postImgDiv">
<div class="postImg">A</div>
<div class="postImg">B</div>
<div>