aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/css/_colon_disabled/index.html
blob: 6bc24da70ad45221c9d4f2bae4cdbf85b87fe9d0 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
title: ':disabled'
slug: 'Web/CSS/:disabled'
tags:
  - CSS
  - Layout
  - Pseudo-class
  - Reference
  - Web
translation_of: 'Web/CSS/:disabled'
---
<div>{{CSSRef}}</div>

<p><a href="/ko/docs/Web/CSS">CSS</a> <strong><code>:disabled</code></strong> <a href="/ko/docs/Web/CSS/Pseudo-classes">의사 클래스</a>는 모든 비활성 요소를 나타냅니다. 비활성 요소란 활성(선택, 클릭, 입력 등등)하거나 포커스를 받을 수 없는 요소를 말합니다. 반대 상태인 활성 요소도 존재합니다.</p>

<pre class="brush: css no-line-numbers notranslate">/* 모든 비활성 &lt;input&gt; 선택 */
input:disabled {
  background: #ccc;
}</pre>

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

{{csssyntax}}

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

<p>다음 예제는 사용자가 청구 주소 입력 칸을 켜거나 끌 수 있는 기능을 <a href="/ko/docs/Web/JavaScript">JavaScript</a> {{event("change")}} 이벤트를 통해 구현한 기본적인 배송 양식입니다.</p>

<h3 id="HTML">HTML</h3>

<pre class="brush: html notranslate">&lt;form action="#"&gt;
  &lt;fieldset id="shipping"&gt;
    &lt;legend&gt;배송지&lt;/legend&gt;
    &lt;input type="text" placeholder="이름"&gt;
    &lt;input type="text" placeholder="주소"&gt;
    &lt;input type="text" placeholder="우편번호"&gt;
  &lt;/fieldset&gt;
  &lt;br&gt;
  &lt;fieldset id="billing"&gt;
    &lt;legend&gt;청구지&lt;/legend&gt;
    &lt;label for="billing-checkbox"&gt;배송지와 동일:&lt;/label&gt;
    &lt;input type="checkbox" id="billing-checkbox" checked&gt;
    &lt;br&gt;
    &lt;input type="text" placeholder="이름" disabled&gt;
    &lt;input type="text" placeholder="주소" disabled&gt;
    &lt;input type="text" placeholder="우편번호" disabled&gt;
  &lt;/fieldset&gt;
&lt;/form&gt;
</pre>

<h3 id="CSS">CSS</h3>

<pre class="brush: css notranslate">input[type="text"]:disabled {
  background: #ccc;
}
</pre>

<h3 id="JavaScript">JavaScript</h3>

<pre class="brush: js notranslate">// 페이지 로딩이 끝날 때까지 기다림
document.addEventListener('DOMContentLoaded', function () {
  // `change` 이벤츠 수신기를 체크박스에 부착
  document.getElementById('billing-checkbox').onchange = toggleBilling;
}, false);

function toggleBilling() {
  // 청구지 텍스트 입력 칸을 모두 선택
  var billingItems = document.querySelectorAll('#billing input[type="text"]');

  // 하나씩 토글
  for (var i = 0; i &lt; billingItems.length; i++) {
    billingItems[i].disabled = !billingItems[i].disabled;
  }
}
</pre>

<h3 id="결과">결과</h3>

<p>{{EmbedLiveSample('예제', 300, 250)}}</p>

<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('HTML WHATWG', '#selector-disabled', ':disabled')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>No change.</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C', '#selector-disabled', ':disabled')}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td>Defines the semantics of HTML and forms.</td>
  </tr>
  <tr>
   <td>{{SpecName('CSS4 Selectors', '#enableddisabled', ':disabled')}}</td>
   <td>{{Spec2('CSS4 Selectors')}}</td>
   <td>No change.</td>
  </tr>
  <tr>
   <td>{{SpecName('CSS3 Selectors', '#enableddisabled', ':disabled')}}</td>
   <td>{{Spec2('CSS3 Selectors')}}</td>
   <td>Defines the pseudo-class, but not the associated semantics.</td>
  </tr>
 </tbody>
</table>

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

<div>


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

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

<ul>
 <li>
  <p>{{Cssxref(":enabled")}}</p>
 </li>
</ul>