<html>
<head>
<title>div居中对齐</title>
<style>
#main {background-color:blue;position: absolute;width:400px;height:200px;left:50%;top:50%;
margin-left:-200px;margin-top:-100px;border:1px solid #00F}
body{margin:0 audio;text-align:center;}
</style>
</head>
<body>
<div id="main"></div>
</body>
</html>
<head>
<title>div居中对齐</title>
<style>
#main {background-color:blue;position: absolute;width:400px;height:200px;left:50%;top:50%;
margin-left:-200px;margin-top:-100px;border:1px solid #00F}
body{margin:0 audio;text-align:center;}
</style>
</head>
<body>
<div id="main"></div>
</body>
</html>