728x90
๋ฐ์ํ
์ ๋๋ฉ์ด์ ๋ง๋ค๊ธฐ
HTML๊ณผ CSS๋ฅผ ์ด์ฉํ์ฌ ์ ๋๋ฉ์ด์ ์ ๋ง๋ค์ด๋ด ์๋ค.
์์
์์์ ๋๋ค
HTML ์์ค
<div class="wrapper">
<div></div>
</div>
<div class="wrapper">
<div></div>
</div>
<div class="wrapper">
<div></div>
</div>
<div class="wrapper">
<div></div>
</div>
<div class="wrapper">
<div></div>
</div>
CSS ์์ค
* {
box-sizing: border-box;
}
body {
background: linear-gradient(to top, #a18cd1 0%, #fbc2eb 100%);
width:100vw;
height:100vh;
display: flex;
justify-content: center;
align-items: center;
margin: 0;
padding: 0;
}
.wrapper {
position: absolute;
animation: x 1s ease-in-out alternate infinite 0s both;
}
.wrapper:nth-of-type(2) {animation-delay: 0.1s}
.wrapper:nth-of-type(3) {animation-delay: 0.2s}
.wrapper:nth-of-type(4) {animation-delay: 0.3s}
.wrapper:nth-of-type(5) {animation-delay: 0.4s}
.wrapper>div {
width: 50px;
height: 50px;
background-color: #fff;
border-radius: 100%;
margin: 40px;
animation: y 1s linear infinite 0s both;
}
.wrapper:nth-of-type(2)>div {
animation-delay: 0.1s;
height: 40px;
width: 40px;
opacity: 0.8;
}
.wrapper:nth-of-type(3)>div {
animation-delay: 0.2s;
height: 30px;
width: 30px;
opacity: 0.7;
}
.wrapper:nth-of-type(4)>div {
animation-delay: 0.3s;
height: 20px;
width: 20px;
opacity: 0.5;
}
.wrapper:nth-of-type(5)>div {
animation-delay: 0.4s;
height: 10px;
width: 10px;
opacity: 0.3;
}
@keyframes x {
0% {
transform: translatex(-100px)
}
100% {
transform: translatex(100px)
}
}
@keyframes y {
25% {
transform: translatey(-50px);
}
0%, 50%, 100% {
transform: translatey(0);
}
75% {
transform: translatey(50px);
}
}
์์ฑ
728x90
๋ฐ์ํ
'CSS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
CSS ์ ๋๋ฉ์ด์ 5. ๋ง์ฐ์ค ์ค๋ฒ ์ ๋๋ฉ์ด์ (3) | 2022.09.21 |
---|---|
CSS ์ ๋๋ฉ์ด์ 4 - ์จ์ด๋ธ ์ ๋๋ฉ์ด์ (3) | 2022.09.21 |
์ ๋๋ฉ์ด์ 2 (2) | 2022.08.30 |
์ ๋๋ฉ์ด์ 1 (2) | 2022.08.30 |
์์ ์จ๊ธฐ๊ธฐ (6) | 2022.08.26 |
๋๊ธ