当前位置:网站首页>Positioning setting horizontal and vertical center (multiple methods)

Positioning setting horizontal and vertical center (multiple methods)

2022-06-26 05:20:00 AAA.. AA

Method 1 :flex

Set in parent box :
display : flex;
align-items: center;
justify-content: center;

Method 2 : float

The son is the father
left :50%
top :50%
transfrom: transletter(-50%,-50%)

Method 3 :

Horizontal center (text-align): center
Vertical center (line-height): Same height as the current block

原网站

版权声明
本文为[AAA.. AA]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206260517566611.html