绝对定位让元素居中

<div style="position:absolute:top:50%;margin-top:-(元素高度)/2;left:50%;margin-left:-(元素宽度)/2;">
(其中负值时为了抵消元素自身的高度和宽度)
posted @ 2016-02-02 15:47  简简和单单  阅读(141)  评论(0编辑  收藏  举报