绝对定位始终居中

方法一:(不能微调)

position:absolute;

left:0; right:0; top:0; bottom:0;

margin:auto;

 

方法二:(可微调)

position:absolute;

top:50%; left:50%;

margin-top:-100px; /*元素高度的一半*/

margin-left:-100px; /*元素宽度的一半*/

方法三:

  1. position: fixed;
  2. top: 0%;
  3. left: 0%;
  4. right: 0%;
  5. bottom: 0%;
  6. margin: auto;
posted @ 2017-08-18 10:56  Monroe_Yu  阅读(210)  评论(0编辑  收藏  举报