aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/html/global_attributes/id/index.html
blob: 034fc62ac17afa465243556be4f4df4dffad991d (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
---
title: id
slug: Web/HTML/Global_attributes/id
tags:
  - Global attributes
  - HTML
  - Reference
  - Web
translation_of: Web/HTML/Global_attributes/id
---
<div>{{HTMLSidebar("Global_attributes")}}</div>

<p><span class="seoSummary"><code><strong>id</strong></code> <a href="/ko/docs/Web/HTML/Global_attributes">전역 특성</a>은 문서 전체에서 유일한 고유식별자(ID)를 정의합니다.</span> 고유식별자의 목적은 <a href="/ko/docs/Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web#프래그먼트">프래그먼트 식별자</a>를 사용해 요소를 가리킬 때와 스크립트 및 스타일 적용 시 특정 요소를 식별하기 위함입니다.</p>

<div>{{EmbedInteractiveExample("pages/tabbed/attribute-id.html","tabbed-shorter")}}</div>

<p class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples </a> and send us a pull request.</p>

<div class="blockIndicator warning">
<p><code>id</code> 특성의 값은 불투명 문자열(opaque string)입니다. 그 말은, 웹 작성자가 <code>id</code> 특성을 통해 사람이 읽을 수 있는 정보를 나타내서는 안된다는 것입니다. (코드 가독성 차원에서는 유용할 수 있습니다. <code>ticket-18569</code><code>r45tgfe-freds&amp;$@</code>을 비교해보세요.)</p>
</div>

<p><code>id</code> 특성의 값이 공백(스페이스나 탭 등)을 포함해서는 안됩니다. 공백으로 값을 구분하는 {{htmlattrxref("class")}} 속성과 달리, 하나의 요소는 하나의 ID만 가질 수 있습니다. 만약 ID에 공백을 넣는다면, 브라우저는 그 공백마저 ID의 일부로 취급합니다.</p>

<div class="note">
<p><strong>참고:</strong> {{glossary("ASCII")}} 문자, 숫자, <code>'_'</code>, <code>'-'</code> 및 <code>'.'</code>를 제외한 문자는 HTML 4에서 허용하지 않았으므로 호환성 문제가 발생할 수 있습니다. 이런 제한은 HTML 5에서는 해제되었으나, 호환성을 위해, ID는 위의 문자로 시작해야 합니다.</p>
</div>

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

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('HTML WHATWG', "dom.html#the-id-attribute", "id")}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>No change from latest snapshot, {{SpecName('HTML5.1')}}</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5.1', "dom.html#the-id-attribute", "id")}}</td>
   <td>{{Spec2('HTML5.1')}}</td>
   <td>Snapshot of {{SpecName('HTML WHATWG')}}, no change from {{SpecName('HTML5 W3C')}}</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C', "dom.html#the-id-attribute", "id")}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td>Snapshot of {{SpecName('HTML WHATWG')}}, now accept <code>'_'</code>, <code>'-'</code> and <code>'.'</code> if not at the beginning fo the id. It is also a true global attribute.</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML4.01', 'struct/global.html#adef-id', 'id')}}</td>
   <td>{{Spec2('HTML4.01')}}</td>
   <td>Supported on all elements but {{HTMLElement("base")}}, {{HTMLElement("head")}}, {{HTMLElement("html")}}, {{HTMLElement("meta")}}, {{HTMLElement("script")}}, {{HTMLElement("style")}}, and {{HTMLElement("title")}}.</td>
  </tr>
 </tbody>
</table>

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



<p>{{Compat("html.global_attributes.id")}}</p>

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

<ul>
 <li>모든 <a href="/ko/docs/Web/HTML/Global_attributes">전역 특성</a>.</li>
 <li><code>id</code> 특성을 반영하는 {{domxref("Element.id")}} 속성.</li>
</ul>