0%

css 相对居中

需求

css 实现相对居中

实现

1
2
3
4
5
6
.element {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}