Html 为什么我的图像没有粘在一起?
我有一个简单的HTML/CSSHtml 为什么我的图像没有粘在一起?,html,css,Html,Css,我有一个简单的HTML/CSS <div class="image-group"> <img src="http://placehold.it/80x80" /> <img src="http://placehold.it/120x120" /> <img src="http://placehold.it/80x80" /> </div> .image-group img { margin: 0; padding:
<div class="image-group">
<img src="http://placehold.it/80x80" />
<img src="http://placehold.it/120x120" />
<img src="http://placehold.it/80x80" />
</div>
.image-group img {
margin: 0;
padding: 0;
}
.图像组img{
保证金:0;
填充:0;
}
为什么图像没有粘在一起?我使用Chrome的Inspector检查元素,它在图像之间没有显示任何内容,但它们是隔开的
我可以通过应用负边距使它们粘在一起,但根据我的说法,它们无论如何都应该粘在一起。html代码中有空间。试试下面
<div class="image-group">
<img src="http://placehold.it/80x80" /><img src="http://placehold.it/120x120" /><img src="http://placehold.it/80x80" />
</div>
查看这篇关于处理具有连续内联块元素(如图像)的空间的博文
谢谢你的链接。最后我把空的地方注释掉了。