在圖像庫的這個例子中: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