请老师帮解答下
来源:2-4 编程练习
慕婉清2005302
2020-09-06 00:07:20
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
/*完善下列代码*/
.per{
width: 300px;
height: 300px;
background: red;
margin-left:200px;
margin-top: 200px;
}
.son{
width: 100px;
height: 100px;
background: blue;
position:absolute;
margin-top: 100px;
margin-left: 100px;
}
</style>
</head>
<body>
<div class="per">
<div class="son"></div>
</div>
</body>
</html>对父div调整的代码中没有添加定位属性,可对子div进行绝对定位后,移动的参照物确是父div生成的红色区域
1回答
同学你好,设置定位后,应该使用left,top等属性设置子div的位置。
参考代码如下:

如果我的回答解决了你的疑惑,请采纳!祝学习愉快!
相似问题