UFO2015
2017-01-16 01:35
bull shit!
absolute error!
.conatiner{
position: relative;
}
.box{
position: absolute;
width: 50%;
height: 50%;
background: red;
transform: translateX(50%), translateY(50%);
}
人老师说的是两栏自适应布局不适合使用absolute,你整个绝对居中,闹哪样啊??
<!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>CSS深入理解之overflow
41720 学习 · 85 问题
相似问题