A盒子300宽高,B盒子100,把B盒子放到A盒子中间
--------------------------------------
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>移动盒子</title>
<style>
.div1{
height: 300px;
width: 300px;
background-color: chartreuse;
position: absolute; /*父类定位*/
border: red 1px solid;
}
.div2{
height: 100px;
width: 100px;
border: red 1px solid;
background-color: red;
margin-top: 100px; /*子类以父类为参照物移动px*/
margin-left: 100px;
}
</style>
</head>
<body>
<div class="div1">
<div class="div2">453日53rewfew</div>
</div>
</body>
</html>