css-If the height is variable, make the text horizontally centered

If you don’t know the height, and don’t know how many lines the text has, and the width has to be fixed, there is really no way to find the answer in various ways, and the effort pays off. Set the padding for the parent element: 15px 0; then the following code will do Up

display: -webkit-box;
-webkit-box-pack: center;
box-pack: center;
-webkit-box-align: center;
box-align: center;

Guess you like

Origin blog.csdn.net/weixin_45663264/article/details/115010859