<html>
<head>
<style>
#div1 {
position: absolute; /*元素定位属性:绝对定位;*/
width:320px;
height:240px;
left:50%;
top:50%;
margin-left:-160px; /*用-(width/2)=-160让left点对准轴心*/
margin-top:-120px; /*用-(height/2)=-120让top点对准轴心*/
border:1px solid #000; /*画一个边框,颜色为黑色*/
}
</style>
</head>
<body>
<div id="div1"> </div>
</body>
</html>