<div class="productcontainer">
<div class="product"><img src="products/p1.jpg" height="75" /><br />Item 1</div>
<div class="product"><img src="products/p1.jpg" height="75" /><br />Item 2</div>
<div class="product"><img src="products/p1.jpg" height="75" /><br />Item 3<br />Test</div>
<div class="product"><img src="products/p1.jpg" height="75" /><br />Item 4</div>
<div class="product"><img src="products/p1.jpg" height="75" /><br />Item 5</div>
</div>
.productcontainer { width: 320px }
.product { width: 100px; height: 100px; display: inline-block; border: solid 1px #000000 }
为什么元素 3 没有在顶部对齐?
最佳答案
您需要将vertical-align: top
添加到.product
。
更多信息,请参阅:
关于html - 为什么盒子没有正确对齐?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5683461/