Css实现Div在页面上垂直居中显示
方法一
<html>
<head>
<title>垂直居中</title>
<style type="text/css">
#floater {height:50%; margin-bottom:-120px;}
#content {clear:both; height:240px; position:relative; border:1px solid red;}
#div0{padding-bottom:35px; }
#div1{position:absolute;bottom:0;height:35px; background-color:red;}
</style>
</head>
<body>
<div id="floater"></div>
<div id="content">
<div id="div0">aa</div>
<div id="div1">bb</div>
</div>
</body>
</html>
方法二
<!doctype html>
<html>
<head>
<style type="text/css">
</style>
</head>
<body>
<div style="position:absolute;top:50%;height:300px;margin-top:-150px;width:100%;background:silver;">
我是垂直居中的Div
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style type="text/css">
</style>
</head>
<body>
<div style="position:fixed;top:50%;left:50%;height:300px;margin-top:-150px;width:200px;margin-left:-100px;background:silver;">
我总是居中的Div,窗口大小调整我也能居中,些方法的缺点是,要确定div本身的高度、宽度
</div>
</body>
</html>
div中图片居中
http://www.cnblogs.com/leejersey/p/3780415.html