gpt4 book ai didi

CSS 图像不适合容器

转载 作者:行者123 更新时间:2023-11-28 16:12:43 24 4
gpt4 key购买 nike

有七张不同大小的图片,我想把所有图片都放在大图片下面。谁能帮我解决这个问题?

.imagelist img{
width: 100px;
border: 2px solid black;
font-size: 0;
}
<div class="wrapper">
<img src="images/wide.jpg" width="100%" alt="wide-image">
</div>
<div class="imagelist">
<img src="images/a.jpg" width="100px;">
<img src="images/b.jpg" width="100px;">
<img src="images/c.jpg" width="100px;">
<img src="images/d.jpg" width="100px; height:90px;">
<img src="images/e.jpg" width="100px;">
<img src="images/f.jpg" width="100px;">
<img src="images/g.jpg" width="100px;">
</div>

enter image description here

最佳答案

您可以使用以下解决方案:

.imagelist img {
float:left;
width:calc(100% / 7 - 4px);
border:2px solid black;
font-size:0;
}
.imagelist {
clear:both;
}
<div class="wrapper">
<img src="http://placehold.it/350x350" width="100%" alt="wide-image">
</div>
<div class="imagelist">
<img src="http://placehold.it/350x350">
<img src="http://placehold.it/350x350">
<img src="http://placehold.it/350x350">
<img src="http://placehold.it/350x350">
<img src="http://placehold.it/350x350">
<img src="http://placehold.it/350x350">
<img src="http://placehold.it/350x350">
</div>

关于CSS 图像不适合容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38083787/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com