水平居中
行内元素:
text-align: center
块级元素
margin: 0 auto
absolute
position: absolute
left: 50%
transform: translateX(-50%)
flex
display: flex
justify-content: center
垂直居中
设置line-height等于height
position
position: absolute
top: 50%
transform: translateY(-50%)
flex
display: flex
align-items: center
table
display: table
display: table-cell
vertical-align: middle