id
The id global attribute assigns a document-unique identifier used for linking, labeling, and scripting.
Syntax
id="unique-name" Examples
<h2 id="pricing">Pricing</h2>
<a href="#pricing">Jump to pricing</a>
Output
Clicking the link scrolls the page to the heading whose id is "pricing".
Notes
The id must be unique within the document. Used as a fragment target, by label for, by aria-labelledby, and via getElementById. ID selectors have high specificity; prefer classes for styling.
Browser & runtime support
| Environment | Since version |
|---|---|
| chrome | 1.0 |
| firefox | 1.0 |
| safari | 1.0 |
| edge | 12 |