定位
html:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#parent{
width: 600px;
height: 600px;
border: 10px solid blue;
margin: 0 auto;
/*外层 盒子 添加 相对定位*/
position: relative;
}
#parent .son1{
width:300px;
height: 300px;
background-color: black;
/*里面的盒子 绝对出现在 外层盒子的 某个角落上*/
position: absolute;
top: 0;
left: 0;
}
#parent .son2{
width:300px;
height: 300px;
background-color: red;
position: absolute;
bottom: 0;
right: 0;
}
</style>
</head>
<body>
<div id="parent">
<div class="son1"></div>
<div class="son2"></div>
</div>
</body>
</html>css:
吐槽一下


还没有留言,还不快点抢沙发?