视频中老师说绝对定位元素受限于父级元素是什么意思??
视频中老师说绝对定位元素受限于父级元素是什么意思??
视频中老师说绝对定位元素受限于父级元素是什么意思??
2017-11-30
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>绝对定位受父级元素影响</title>
<style>
.box1 {
width:400px;
height:400px;
background-color:red;
text-align:right;
position: relative;
}
.box2 {
width:200px;
height:200px;
background-color:green;
position: absolute;
left: 0;
top: 0;
}
</style>
</head>
<body>
<div class="box1">box1
<div class="box2">box2块的绝对定位受box1块的影响(这就叫绝对定位受父级影响,我这么说你能理解不)</div>
</div>
</body>
</html>
举报