<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
#wrap {
width: 100%;
position: relative;
/* height: 100vh; */
height: 2500px;
background-color: rgb(95, 211, 211);
}
.box {
width: 100px;
height: 100px;
position: relative;
}
.box span {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#red {
position: absolute;
background-color: red;
top: 50px;
left: 50px;
z-index: 3;
display: flex;
justify-content: center;
align-items: center;
color: white;
font-weight: lighter;
}
#green {
position: absolute;
background-color: green;
top: 150px;
left: 150px;
z-index: 2;
/* display: flex;
justify-content: center;
align-items: center; */
color: white;
font-weight: lighter;
}
#blue {
position: absolute;
background-color: blue;
top: 250px;
left: 250px;
z-index: 1;
display: flex;
justify-content: center;
align-items: center;
color: white;
font-weight: lighter;
}
img {
width: 100px;
}
#img3 {
position: fixed;
top: 20%;
left: 35%;
z-index: 1;
}
#img4 {
position: sticky;
top: 300px;
left: 50%;
}
#img5 {
position: sticky;
top: 20%;
left: 80%;
}
#wrap1 {
height: 500px;
position: relative;
}
#wrap2 {
position: relative;
height: 500px;
background-color: cadetblue;
z-index: 0;
}
#img6 {
position: sticky;
top: 30%;
left: 60%;
}
</style>
</head>
<body>
<div id="wrap">
<div id="wrap1">
<div class="box" id="red">red</div>
<div class="box" id="green"><span>green</span></div>
<div class="box" id="blue">blue</div>
<span style="padding: 50px; background-color: brown; position: absolute; top: 58px; left: 546px;">red</span>
<span style="padding: 50px; background-color: brown; position: absolute; top: 179px; left: 423px;">red</span>
<span style="padding: 50px; background-color: brown; position: absolute; top: 300px; left: 300px;">red</span>
<img src="../images/zz.PNG" alt="" >
<img src="../images/zz.PNG" alt="">
<img src="../images/zz.PNG" alt="" id="img3">
<img src="../images/zz.PNG" alt="" id="img4">
<img src="../images/zz.PNG" alt="" id="img5">
<p style="position: absolute; bottom: 5%; left: 45%;">가지마..</p>
</div>
<hr>
<hr>
<div id="wrap2">
<img src="../images/zz.PNG" alt="" id="img6">
<p style="position: absolute; bottom: 5%; left: 55%;">가지마..</p>
</div>
</div>
</body>
</html>
bandicam 2023-05-24 21-44-51-220.mp4
0.56MB
'Html > 연습' 카테고리의 다른 글
그리드+반응형 연습 (0) | 2023.05.26 |
---|---|
grid 연습 (0) | 2023.05.24 |