如何让图片或文字垂直居中于div层
体参照方法如下:
以下是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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>居中</title>
</head>
<style type="text/css">
.imageWrap{ width:200px; height:200px; text-align:center; border:#999 solid 1px; display:table-cell; vertical-align:middle; position:relative;}
.imageWrap .outer{ +position:absolute; +top:50%;+left:0}
.imageWrap .inner{ +position:relative; +top:-50%;+left:0}
.imageWrap img{ display:block; margin:0 auto}
</style>
<body>
<div class="imageWrap">
<div class="outer">
<div class="inner">
<img src="http://www.baidu.com/img/baidu.gif"/>
<a href="#">百度</a>
</div>
</div>
</div>
</body>
</html>
<a href="http://www.okhan.net/">欢迎访问傲看软件园,www.okhan.net</a>