728x90
CSS : μ λλ©λμ λ§λ€κΈ° : λ¬Όκ²° μ¨~μ΄λΆ~~~ π π
μ΄λ² μκ°μλ CSS μ€μ΅μΌλ‘ μλ€μ΄ νλλΌ νλ λ―ν μ λλ©μ΄μ
μ λ§λ€μ΄λ³΄κ² μ΅λλ€. π
μ€λ μ€μ΅μ ν¬μΈνΈλ νΌκ·Έμ SCSS κ·Έλ¦¬κ³ λ°λ³΅λ¬Έμ
λλ€~!
#1. PUG
λ€μμ PUG μ½λμ μ»΄νμΌν HTML μ½λ μ λλ€!
πΆ PUG
div.circle-wrap
- for (var x =1; x <= 12; x++)
div.row
- for (var y = 1; y <= 12; y++)
div.circle
πΏ HTML μ»΄νμΌ ver
<div class="circle-wrap">
<div class="row">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
<div class="row">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
<div class="row">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
<div class="row">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
<div class="row">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
<div class="row">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
<div class="row">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
<div class="row">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
<div class="row">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
<div class="row">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
<div class="row">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
<div class="row">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
</div>
#2. SCSS
λ€μμ SCSS μ½λμ μ»΄νμΌν CSS μ½λ μ
λλ€!
μ€λμ ν¬μΈνΈλ mixinμ
λλ€. SCSSλ₯Ό μ¬μ©ν λ μ£Όλ‘ μ¬μ©νλ ν¨ν΄μΌλ‘ μ½λλ₯Ό μ¬μ¬μ©νκΈ° μν΄μ λ§λ€μ΄μ§ ν¨ν΄μ
λλ€.
π§Έ SCSS
@mixin center {
display : flex;
align-items: center;
justify-content: center;
}
body {
@include center;
height: 100vh;
background-image: linear-gradient(45deg, #00DBDE 0%, #FC00FF 100%);
}
.row {
display: flex;
.circle {
width: 10px;
height: 10px;
border-radius: 50%;
margin: 5px 10px;
background: #fff;
transform-origin : top center;
animation : spin 1s linear infinite;
}
@keyframes spin {
0% {transform : scale(1.1) rotate(0deg);}
50% {transform : scale(0.2) rotate(180deg);}
100% {transform : scale(1.1) rotate(360deg);}
}
}
@for $i from 1 through 12 {
.row:nth-child(#{$i}) .circle {animation-delay : 100ms * $i;}
}
π CSS μ»΄νμΌ ver
body {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
background-image: linear-gradient(45deg, #00DBDE 0%, #FC00FF 100%);
}
.row {
display: flex;
}
.row .circle {
width: 10px;
height: 10px;
border-radius: 50%;
margin: 5px 10px;
background: #fff;
transform-origin: top center;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% {
transform: scale(1.1) rotate(0deg);
}
50% {
transform: scale(0.2) rotate(180deg);
}
100% {
transform: scale(1.1) rotate(360deg);
}
}
.row:nth-child(1) .circle {
animation-delay: 100ms;
}
.row:nth-child(2) .circle {
animation-delay: 200ms;
}
.row:nth-child(3) .circle {
animation-delay: 300ms;
}
.row:nth-child(4) .circle {
animation-delay: 400ms;
}
.row:nth-child(5) .circle {
animation-delay: 500ms;
}
.row:nth-child(6) .circle {
animation-delay: 600ms;
}
.row:nth-child(7) .circle {
animation-delay: 700ms;
}
.row:nth-child(8) .circle {
animation-delay: 800ms;
}
.row:nth-child(9) .circle {
animation-delay: 900ms;
}
.row:nth-child(10) .circle {
animation-delay: 1000ms;
}
.row:nth-child(11) .circle {
animation-delay: 1100ms;
}
.row:nth-child(12) .circle {
animation-delay: 1200ms;
}
728x90
'CSS' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[CSS] μ λλ©μ΄μ 06 : ν΅!ν΅!ν΅! ν μ€νΈ (2) | 2022.09.29 |
---|---|
[CSS] μ λλ©μ΄μ 05 : κΉμ¦€λλ μ 체 ν¨κ³Ό (5) | 2022.09.21 |
[CSS] μ λλ©μ΄μ μ€μ΅ : κ±·κΈ° μ λλ©μ΄μ (from.ν 맀ν ) (4) | 2022.09.08 |
[CSS] CSS μ λλ©μ΄μ μ λν΄ μμ보μ! (4) | 2022.09.08 |
[CSS] SVG : μ λλ©μ΄μ ꡬννκΈ° (5) | 2022.09.08 |
λκΈ