blob: f471cce411bdac9d3eb553023e619553ec23aa0f (
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
|
---
title: ':not()'
slug: 'Web/CSS/:not'
tags:
- CSS
- Layout
- Pseudo-class
- Reference
translation_of: 'Web/CSS/:not'
---
<div>{{ CSSRef() }}</div>
<p>부정(<strong>negation</strong>) <a href="/ko/docs/Web/CSS/Pseudo-classes" title="Pseudo-classes">CSS 가상 클래스</a> <code>:not(X)</code>는 인수로 간단한 선택자(selector) <var>X</var>를 취하는 기능 표기법입니다. 인수로 표시되지 않은 요소와 일치합니다. <var>X</var>는 다른 부정 선택자를 포함해서는 안 됩니다.</p>
<div class="note"><strong>주의:</strong>
<ul>
<li>쓸모없는 선택자는 이 가상 클래스를 사용하여 작성될 수 있습니다. 예를 들어, <code>:not(*)</code>은 임의 요소가 아닌 모든 요소와 일치합니다. 그래서 규칙이 결코 적용되지 않습니다.</li>
<li>다른 규칙을 다시 작성할 수 있습니다. 가령 <code>foo:not(bar)</code>는 간단한 <code>foo</code>와 같은 요소와 일치합니다. 그럼에도 불구하고 첫 요소의 <a href="/ko/docs/Web/CSS/Specificity" title="Specificity">명시도</a>가 더 높습니다.</li>
<li><code>:not(foo){}</code>는 <strong>{{HTMLElement("html")}} 및 {{HTMLElement("body")}} 포함</strong> 뭐든지 <code>foo</code>가 아닌 것과 일치합니다.</li>
<li>이 선택자는 한 요소에만 적용됩니다. 따라서 모든 조상(ancestor)을 제외하는 데 사용할 수 없습니다. 예를 들어, <code>body :not(table) a</code>는 {{HTMLElement("tr")}} 요소가 선택자의 <code>:not()</code> 부분과 일치하기 때문에, 여전히 표 내부 링크에 적용됩니다.</li>
</ul>
</div>
<h2 id="Syntax" name="Syntax">구문</h2>
<pre class="syntaxbox">:not(selector) { <em>style properties</em> }</pre>
<h2 id="Examples" name="Examples">예제</h2>
<pre class="brush: css">p:not(.classy) { color: red; }
body :not(p) { color: green; }</pre>
<p>위의 CSS 및 아래 HTML이 주어진다면...</p>
<pre class="brush: html"><p>Some text.</p>
<p class="classy">Some other text.</p>
<span>One more text<span>
</pre>
<p>이 같은 출력을 얻습니다:</p>
<p>{{ EmbedLiveSample('Examples', '', '', '', 'Web/CSS/:not') }}</p>
<h2 id="Specifications" name="Specifications">명세</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">명세</th>
<th scope="col">상태</th>
<th scope="col">설명</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ SpecName('CSS4 Selectors', '#negation', ':not()') }}</td>
<td>{{ Spec2('CSS4 Selectors') }}</td>
<td>인수로 일부 비 간단 선택자를 허용토록 확장.</td>
</tr>
<tr>
<td>{{ SpecName('CSS3 Selectors', '#negation', ':not()') }}</td>
<td>{{ Spec2('CSS3 Selectors') }}</td>
<td>초기 정의.</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility" name="Browser_compatibility">브라우저 호환성</h2>
<p>{{Compat("css.selectors.not")}}</p>
|