2011-04-18 69 views

回答

3
#myLI a#myAnchor img{ 
float:left; 
margin:margin to center; 
} 

边缘到中心是,你需要根据文本的中心给予的值。例如margin:5px 5px 0px 2px;

+2

做到这一点的最佳方法是将图像(图标)作为背景。这是因为谷歌会忽略背景。你不想让谷歌索引你的所有图标。我总是这样做insted。 #myLI a#myAnchor {background:url(icon.png)no-repeat 0px 5px; padding:0px 0px 0px 20px;}其中背景中的0px是左边距,5px是上边距。并且在填充时,您需要在文本左侧留出空间以容纳图像....这对所有浏览器来说都会更好。 – Karthik 2011-04-18 09:10:46