a.
div{
width: 200px;
height: 200px;
text-align: center; //水平居中
line-height: 200px; //垂直居中
}
b.巧用display
div {
width: 200px;
height: 200px;
display: flex;
justify-content: center; //水平居中
align-items: center; //垂直居中
}