绝对定位让元素彻底居中的两种方法

方法一:(不能微调) 父容器:css position: absolute; left: 0; right: 0; top: 0; bottom: 0; margin: auto; 方法二:(可微调) 要居中的元素:flex position: absolute; top: 50%; left: 50%; margin-top: -100px; /* 元素高度的一半 */ margin-left:
相关文章
相关标签/搜索