css 相对定位怎么改成绝对定位
1个回答
展开全部
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<title></title>
<style>
* {
margin: 0;
padding: 0;
}
.demo {
width: 100%;
}
.aa,
.bb{
box-sizing: border-box;
border: 1px solid #000000;
height: 350px;
float: left;
text-align: center;
line-height: 350px;
}
.aa{position: relative;}
.bb{position: absolute;top: 350px;left: 100px;}
</style>
</head>
<body>
<div class="demo">
<div class="aa" style="width: 30%;">
相对定位
</div>
<div class="bb" style="width: 50%">
绝对定位,参照物为body
</div>
</div>
</body>
</script>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询