Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

이 문서는 아직 자원 봉사자들이 한국어로 번역하지 않았습니다. 함께 해서 번역을 마치도록 도와 주세요!

The id global attribute defines a unique identifier (ID) which must be unique in the whole document. Its purpose is to identify the element when linking (using a fragment identifier), scripting, or styling (with CSS).

This attribute's value is an opaque string: this means that web author must not use it to convey any information. Particular meaning, for example semantic meaning, must not be derived from the string.

This attribute's value must not contain whitespace (spaces, tabs etc.). Browsers treat non-conforming IDs that contain whitespace as if the whitespace is part of the ID. In contrast to the class attribute, which allows space-separated values, elements can only have one single ID.

Note: Using characters except ASCII letters and digits, '_', '-' and '.' may cause compatibility problems, as they weren't allowed in HTML 4. Though this restriction has been lifted in HTML 5, an ID should start with a letter for compatibility.

Specifications

Specification Status Comment
WHATWG HTML Living Standard
The definition of 'id' in that specification.
Living Standard No change from latest snapshot, HTML5.1
HTML5.1
The definition of 'id' in that specification.
Working Draft Snapshot of WHATWG HTML Living Standard, no change from HTML5
HTML5
The definition of 'id' in that specification.
Recommendation Snapshot of WHATWG HTML Living Standard, now accept '_', '-' and '.' if not at the beginning fo the id. It is also a true global attribute.
HTML 4.01 Specification
The definition of 'id' in that specification.
Recommendation Supported on all elements but <base>, <head>, <html>, <meta>, <script>, <style>, and <title>.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) (Yes)[1] (Yes) (Yes) (Yes)
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes)[1] (Yes) (Yes) (Yes)

[1] id is a true global attribute only since Gecko 32.0 (Firefox 32.0 / Thunderbird 32.0 / SeaMonkey 2.29).

See also

문서 태그 및 공헌자

 이 페이지의 공헌자: Ms2ger, markg, Sebastianz, teoli
 최종 변경: Ms2ger,