批改状态:未批改
老师批语:
定位:
四种模式:static(文档流),relative(相对定位),avsolute(绝对定位),fixed(固定定位)
四个位置:left、right、top、bottom
案例:
完成一个四方形魔盒排序:
完成效果:
![1522568520685721.png OBSBC)}4}8WD_3E$[G]CT{W.png](https://img.php.cn//upload/image/282/902/893/1522568520685721.png)
代码部分:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>
</title>
<style type="text/css">
.box1{
height: 200px;
width: 200px;
background: #000000;
position: relative;
top: 200px;
}
.box2{
height: 200px;
width: 200px;
background: #87CEFA;
position: relative;
top: -200px;
left: 200px;
}
.box3{
height: 200px;
width: 200px;
background: #FFA500;
position: relative;
left: 200px;
}
.box4{
height: 200px;
width: 200px;
background: #FF0000;
position: relative;
top: -400px;
left: 400px;
}
</style>
</head>
<body>
<div class="box1"></div>
<div class="box2"></div>
<div class="box3 "></div>
<div class="box4"></div>
</body>
</html>点击 "运行实例" 按钮查看在线实例
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号