aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/css/_colon_root/index.html
blob: 6dd41fb2ecff6e06448c2f5b7c7cce03a2b1340a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
title: ':root'
slug: 'Web/CSS/:root'
tags:
  - CSS
  - Layout
  - Pseudo-class
  - Reference
  - Selector
  - Web
translation_of: 'Web/CSS/:root'
---
<div>{{CSSRef}}</div>

<p><a href="/ko/docs/Web/CSS">CSS</a> <strong><code>:root</code></strong> <a href="/ko/docs/Web/CSS/Pseudo-classes">의사 클래스</a>는 문서 트리의 루트 요소를 선택합니다 HTML의 루트 요소는 {{htmlelement("html")}} 요소이므로, <code>:root</code><a href="/ko/docs/Web/CSS/Specificity">명시도</a>가 더 낮다는 점을 제외하면 <code>html</code> 선택자와 똑같습니다.</p>

<pre class="brush: css no-line-numbers notranslate">/* 문서의 루트 요소 선택
   HTML에서는 &lt;html&gt; */
:root {
  background: yellow;
}</pre>

<h2 id="구문">구문</h2>

{{csssyntax}}

<h2 id="예제">예제</h2>

<h3 id="전역_CSS_변수_선언하기">전역 CSS 변수 선언하기</h3>

<p><code>:root</code>는 전역 <a href="/ko/docs/Web/CSS/Using_CSS_custom_properties">CSS 변수</a> 선언에 유용하게 사용할 수 있습니다.</p>

<pre class="brush: css notranslate">:root {
  --main-color: hotpink;
  --pane-padding: 5px 42px;
}
</pre>

<h2 id="명세">명세</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('CSS4 Selectors', '#root-pseudo', ':root')}}</td>
   <td>{{Spec2('CSS4 Selectors')}}</td>
   <td>No change.</td>
  </tr>
  <tr>
   <td>{{SpecName('CSS3 Selectors', '#root-pseudo', ':root')}}</td>
   <td>{{Spec2('CSS3 Selectors')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="브라우저_호환성">브라우저 호환성</h2>



<p>{{Compat("css.selectors.root")}}</p>

<h2 id="같이_보기">같이 보기</h2>

<ul>
 <li>{{htmlelement("html")}}</li>
 <li>{{domxref("Document.rootElement")}}</li>
 <li>{{domxref("Node.getRootNode()")}}</li>
 <li>{{domxref("Node.rootNode")}}</li>
 <li>{{domxref("Element.shadowRoot")}}</li>
 <li>{{domxref("ShadowRoot")}}</li>
</ul>