This page was translated from English by the community.Learn more and join the MDN Web Docs community.
:root
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015년 7월.
CSS:root의사 클래스는 문서 트리의 루트 요소를 선택합니다 HTML의 루트 요소는<html> 요소이므로,:root의명시도가 더 높다는 점을 제외하면html 선택자와 똑같습니다.
css
/* 문서의 루트 요소 선택 HTML에서는 <html> */:root { background: yellow;}In this article
구문
Error: could not find syntax for this item예제
>전역 CSS 변수 선언하기
:root는 전역CSS 변수 선언에 유용하게 사용할 수 있습니다.
css
:root { --main-color: hotpink; --pane-padding: 5px 42px;}명세
| Specification |
|---|
| Selectors Level 4> # root-pseudo> |