css水平垂直居中
flex
.parent {
display: flex;
justify-conent: center;
align-items: center;
}
或者直接
.parent {
display: flex;
}
.child {
margin: auto;
}
table
.parent {
display: table;
text-align: center;
}
.child {
display: table-cell;
vertical-align: middle;
}