原文地址:
https://blog.csdn.net/liuhailiuhai12/article/details/55252283
1. .parent{
400px;
height:500px;
display:flex;
justify-content: center;
align-items: center;
}
2.单行文字垂直居中
line-height等于父类的height
3.display:table和table-cell
.parent { display: table; 300px; height: 300px; text-align: center; } .son { display: table-cell; height: 200px; background-color: yellow; vertical-align: middle; }
原文地址:https://www.cnblogs.com/chen-cong/p/8076442.html