bull shit!
absolute error!
.conatiner{
position: relative;
}
.box{
position: absolute;
width: 50%;
height: 50%;
background: red;
transform: translateX(50%), translateY(50%);
}
人老师说的是两栏自适应布局不适合使用absolute,你整个绝对居中,闹哪样啊??
https://learning.xgqfrms.xyz/CSS3/float%20&%20position/absolute-center.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>absolute-center</title>
<style>
.box2{
width: 50%;
height: 50%;
background: red;
position: absolute;
transform: translateX(50%) translateY(50%);
}
</style>
</head>
<body>
<div>
<!-- 50% x 50% center-->
</div>
</body>
</html>