π¦ CSS μμ ννμ λν΄ μμλ΄ μλ€ !
CSSμμ μμμ μ§μ νλ μΈκ°μ§ λ°©λ²(16μ§μ, rgba, hsl)μ λν΄ μμλ΄ μλ€.
π 16μ§μ RGB
16μ§μ RGB : #02798b : hash/pound κΈ°νΈ(#)μ 6κ°μ 16μ§μλ‘ νν
16μ§μλ 0κ³Ό f(15) : 0123456789sbcdef : μ¬μ΄μ κ°μΌλ‘ ꡬμ±λλ©°, μ΄ 256κ°(16*16)μ μ μ§μ κ°λ₯
.one {
background-color: #02798b;
}
.two {
background-color: #c55da1;
}
.three {
background-color: #128a7d;
}
<div class="wrapper">
<div class="box one">#02798b</div>
<div class="box two">#c55da1</div>
<div class="box three">#128a7d</div>
</div>
π RGBκ° / RGBA κ°
RGB : rgb(λΉ¨κ°, λ
Ήμ, νλ)λ‘ μ§μ : κ° μ±λ(맀κ°λ³μ)μ΄ 0κ³Ό 255 μ¬μ΄μ 10μ§μλ‘ νν
RGBA : rgba(λΉ¨κ°, λ
Ήμ, νλ, μν)λ‘ μ§μ : μν μ±λ μΆκ°, λΆν¬λͺ
λ(opacity) μ μ΄ κ°λ₯
+ opacity : 0(μμ ν¬λͺ
) ~ 1(μμ λΆν¬λͺ
)
β μμμ μν μ±λ μ€μ vs opacity μμ± μ€μ
βοΈ rgba μμ μ€μ : μ§μ ν μμλ§ λΆν¬λͺ
νκ² μ€μ
βοΈ opacity μ€μ : μμμ κ·Έ μμ μλ λͺ¨λ κ²μ λΆν¬λͺ
νκ² μ€μ
.one {
background-color: rgba(2, 121, 139, .3);
}
.two {
background-color: rgba(197, 93, 161, .7);
}
.three {
background-color: rgba(18, 138, 125, .9);
}
<div class="wrapper">
<div class="box one">rgba(2, 121, 139, .3)</div>
<div class="box two">rgba(197, 93, 161, .7)</div>
<div class="box three">rgba(18, 138, 125, .9)</div>
</div>
π HSLκ° / HSLA κ°
HSL : hsl(μμ‘°, μ±λ, λͺ
λ)λ‘ μ§μ
HSLA : hsl(μμ‘°, μ±λ, λͺ
λ, μν)λ‘ μ§μ
μμ‘°(Hue) : μμμ κΈ°λ³Έ μμ, 0 ~ 360 μ¬μ΄μ κ° μ¬μ©
μ±λ(Saturation) : μμ΄ μΌλ§λ μλμ§, 0 ~ 100% μ¬μ΄μ κ° μ¬μ©, 0(μ μμ, νμ) ~ 100%(μ 체 μμ μ±λ)
λͺ
λ(Lightness) : μμ΄ μΌλ§λ λ°μμ§, 0 ~ 100% μ¬μ΄μ κ° μ¬μ©, 0(κ²μμ) ~ 100%(ν°μ)
.one {
background-color: hsla(188, 97%, 28%, .3);
}
.two {
background-color: hsla(321, 47%, 57%, .7);
}
.three {
background-color: hsla(174, 77%, 31%, .9);
}
<div class="wrapper">
<div class="box one">hsla(188, 97%, 28%, .3)</div>
<div class="box two">hsla(321, 47%, 57%, .7)</div>
<div class="box three">hsla(174, 77%, 31%, .9)</div>
</div>
'CSS' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
CSS | μμλ₯Ό μ¨κΈ°λ 5κ°μ§ λ°©λ² (11) | 2022.08.26 |
---|---|
CSS | λ¨μ | μ λκΈΈμ΄μ μλκΈΈμ΄ (3) | 2022.08.24 |
CSS | μ΄λ―Έμ§ μ€νλΌμ΄νΈ(image sprite) / ir ν¨κ³Όμ background ννκΉμ§ (4) | 2022.08.20 |
CSS | μμ§μ΄λ κ°μμ§ λ§λ€κΈ° (8) | 2022.08.18 |
CSS | SCSS (4) | 2022.08.18 |
λκΈ