div盒子的居中

<html>
<title>XXXX</title>
<meta charset="utf-8" />
<style type="text/css">
*{
margin:0px;
padding:0px;
}

#content{
width:400px;
height:600px;
border:1px solid red;  /*边框样式*/
position:absolute;
top:50%;
left:50%;
margin-top:-300px;  /* -301px;*/
margin-left:-200px;  /*-201px*/
}
</style>
<body>
     <div id="content">
         ......
     </div>
</body>
</html>

 

posted @ 2016-01-04 15:23  侠岚之弋痕夕  阅读(129)  评论(0编辑  收藏  举报
Where is the starting point, we don't have a choice, but the destination where we can pursue!