아래의 경우는 모든 요소에서 활용는 되는 경우입니다.
:root {
--clr: #ff2972; /* 모든 요소에 적용할 색상 */
}
#clock div {
color: var(--clr);
}
<div id="clock">
<div id="hr" style="--clr:#ff2972;"></div>
<div id="min" style="--clr:#fee800;"></div>
<div id="sec" style="--clr:#04fc43;"></div>
</div>
** css **
#sec,
#min,
#hr {
position: absolute;
display: flex;
justify-content: center;
align-items: center;
inset: 0;
text-align: center;
color: var(--clr);
}
// 이 경우는 --clr은 개별 3가지 객상으로 분리되어 사용이 됩니다.
nth-child(5n + 5) 패턴 해석 (0) | 2025.05.13 |
---|---|
~ (틸트)선택자 , + 선택자 활용 (0) | 2025.05.13 |
normalize.css 와 CssBaseline (1) | 2025.05.12 |
콜론 - 단일 콜론, 이중 콜론 (1) | 2025.01.28 |
radialGradient (0) | 2025.01.07 |