css图片垂直居中,比较简单的实现方法:
html:
<div class="testBox">
<span class="hook"></span>
<img src="http://www.google.com.hk/intl/zh-CN/images/logo_cn.png" alt="图片垂直居中" />
</div>
style:
.testBox{border:1px solid #ccc;width:500px;height:400px;text-align:center;}
.testBox .hook{display:inline-block;width:0;height:100%;overflow:hidden;margin-left:-1px;font-size:0;line-height:0;vertical-align:middle;}
.testBox img{vertical-align:middle;border:0 none;}