Movatterモバイル変換


[0]ホーム

URL:


  1. 개발자를 위한 웹 기술
  2. CSS
  3. CSS 참고서
  4. Selectors
  5. :root

This page was translated from English by the community.Learn more and join the MDN Web Docs community.

View in EnglishAlways switch to English

: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;}

구문

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

브라우저 호환성

같이 보기

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp