>我有以下代码
.HTML:
<div class="dropShadow">
<img src="images/headerimage" />
</div>
.CSS:
div.dropShadow {
background-image: url('dropshadow.png');
background-position: bottom center;
background-repeat: no-repeat;
padding-bottom: 19px; /* the height of the shadow */
}
但是,在Firefox上一切都很好,而在Chrome和IE上,图像底部和定位背景图像顶部之间有一个小空白区域。我删除了它周围的所有空白,但我不确定要尝试什么规则。有什么建议吗?
在 IMG 中写垂直对齐:顶部或显示:块。这样写:
img{
vertical-align:top;
}