在图像库的这个例子中:HTML img行为 - 为什么浮动时没有边距?
http://www.w3schools.com/css/tryit.asp?filename=trycss_float_elements
<head>
<style>
.thumbnail
{
float:left;
width:110px;
height:90px;
margin:5px;
}
</style>
</head>
<body>
<h3>Image Gallery</h3>
<p>Try resizing the window to see what happens when the images does not have enough room.</p>
<img class="thumbnail" src="klematis3_small.jpg" width="116" height="90">
<img class="thumbnail" src="klematis4_small.jpg" width="120" height="90">
</body>
</html>
如果宽度从.thumbnail类然后图像被放在旁边彼此而不之间的空间中除去。但对于没有浮动的常规图像元素,自动出现一些边距。我需要了解一般行为。浮动的行为是它们彼此相邻放置。为什么影响图像元素的边距?
感谢您的任何帮助。
我使用display:block作为.thumbnail。然而没有保证金。 :( – 2013-03-25 18:26:44
Baloney。将其更改为50px,您将看到不同之处。 – 2013-03-25 18:35:08