Files
ClassContent/历届学生/熊坤/2019-03-15/定位学习.html
2024-09-27 02:06:13 +08:00

72 lines
1.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>css定位</title>
<style>
body {
margin: 0;
height: 2000px;
}
.box-1,
.box-2,
.box-3,
.box-4 {
width: 150px;
height: 150px;
float: left;
}
.box-1 {
background: yellow;
}
.box-2 {
background: black;
position: relative;
left: 40px;
top: 50px;
z-index: -5;
}
.box-3 {
background: blueviolet;
position: relative;
}
.box-3-1 {
width: 80px;
height: 80px;
background: green;
position: absolute;
left: 17px;
top: 107px;
z-index: -2;
}
.box-4 {
background: red;
}
.box-4:hover {
background: rgb(18, 185, 60);
}
.box-5 {
background: #8d8d8d;
position: fixed;
right: 0px;
bottom: 0px;
}
</style>
</head>
<body>
<div class="box-1"></div>
<div class="box-2"></div>
<div class="box-3">
<div class="box-3-1"></div>
</div>
<div class="box-4"></div>
<div class="box-5">
<img src="https://tpc.googlesyndication.com/simgad/4802151631125041737/downsize_200k_v1?w=400&h=209" alt="" srcset="">
</div>
</body>
</html>