水平居中:
- inline元素:text-align:center
- block元素:margin:auto
- absolute:left:50% + margin-left负值
垂直居中:
- inline元素:line-height高度等于行高height
- absolute:top:50% + margin-top负值(需考虑子元素宽高)
- absolute:transform(-50%,-50%) (兼容性一般,CSS3)
- absolute:top,left,bottom,right=0 + margin:auto(最优解,兼容性好)