让图片 div居中实现代码

http://www.huomaw.com/css/201010/8171.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">   
<head>   
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />   
<title>hezc</title>   
<style type="text/css">   
.hezc{width:200px; height:200px;line-height:200px;font-size:180px;text-align:center;display:table-cell; vertical-align:middle;border:1px solid #ccc}   
.hezc img{ vertical-align:middle;}   
</style>   
</head>   
<body>   
<div class="hezc">   
<img src="http://www.jb51.net/images/logo.gif" border="1" widht="100" height="100"/>   
</div>   
</body>   
</html>

你可能感兴趣的:(div居中)