【发布时间】:2011-05-04 03:52:50
【问题描述】:
我正在尝试在此小提琴中使用带有 <a> 元素的背景图像,但图像仅居中与 IE 中的文本对齐。如何在所有浏览器中居中对齐图像?
HTML:
<table>
<tr>
<td>
<select>
<option>1</option>
<option>33</option>
<option>c</option>
<option>a</option>
<option>aaef</option>
</select>
text
<a href="#"></a>
</td>
</tr>
</table>
CSS:
a{
background-image: url(http://stefankendall.com/files/excel.png);
width: 16px;
height: 16px;
display: inline-block;
}
【问题讨论】:
-
我在您的示例中看不到问题。已在 Chrome 和 IE6 中检查。
-
也许指定
background-position? -
图片在 chrome 中为上对齐,在 IE 中为中对齐。
-
我尝试了各种背景位置,但它们似乎没有任何影响。
-
你说的是(垂直?)锚点内背景图像的对齐方式,还是锚点相对于
text的对齐方式?
标签: html css button html-table background-image