<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS绝对定位-父级有定位的情况</title>
<style>
.grandfather{
width: 500px;
height: 500px;
position: relative;
background-color:blue;
}
.father{
width: 300px;
height: 300px;
/* position: relative; */
background-color:pink;
}
.son{
width: 100px;
height: 100px;
position: absolute;
right: 10px;
bottom:10px;
background-color:red;
}
</style>
</head>
<body>
<div class="grandfather">
<div class="father">
<div class="son">
</div>
</div>
</div>
</body>
</html>
CSS绝对定位-父级有定位的情况
最新推荐文章于 2023-04-19 17:21:09 发布