2013-12-20 82 views
0

爲什麼此圖片未居中對齊?居中對齊圖片

<div style=" width:70%; margin:0 auto; padding:0.2%; border:1px solid #000; "> 
<img src="images/social.png" width="227" height="68" style="border:1px solid #000; 
    border-radius:5px; width:auto; margin:0 auto; display:block;" /></div> 

其簡單的問題。請任何快速解決方案。

感謝,

回答

0

它的簡單嘗試使用行高屬性及其在PX等效值設置爲容器的高度e.g //容器

<div class="container" align="center"> 
<img src="http://static.adzerk.net/Advertisers/46a9844d6e504212a85bc72ddd7dd829.png"  width="40" height="40"> 
</div> 
//css 
.container{ 
    width:200px; 
    height:200px; 
    line-height:200px; 
    border:1px solid #666; 
    margin:0 auto; 
}