Fork me on GitHub

图片水平垂直居中

效果仅见:http://runjs.cn/detail/tkid13aj

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style type="text/css">
body{ margin:0; padding:0;}
dl,dt,dd,img{ margin:0; padding:0;}
img{ border:0;}
dl{ float:left; width:135px; margin:0 0 0 30px; text-align:center; display:inline;}
dl dt{ width:133px; height:133px; border:1px solid #f00; overflow:hidden; position:relative;}
dl dd{ width:133px; line-height:20px;}
dl dt img{ vertical-align:middle; width:60px; height:auto;}
.span_box{ display:inline-block; *display:inline; *zoom:1; height:100%; width:1px; margin-left:-1px; vertical-align:middle;}
</style>
</style>
</head>

<body>
<dl>
<dt><a href="#"><img src="http://fgm.cc/learn/lesson10/img/03.jpg" alt="" /><span class="span_box"></span></a></dt>
<dd>11111</dd>
</dl>
<dl>
<dt><a href="#"><img src="http://fgm.cc/learn/lesson10/img/03.jpg" alt="" /><span class="span_box"></span></a></dt>
<dd>22222</dd>
</dl>
</body>
</html>

 

posted on 2014-06-25 15:27  雨为我停  阅读(178)  评论(0编辑  收藏  举报