HTML · Global attributes
id
A unique identifier for one element in the document. Used by CSS, labels, anchors and JavaScript.
Syntax
id="unique-name"Example
Try it
Notes
IDs must be unique. Duplicate IDs break label associations and querySelector.
More in this group
Learn this in the course
Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.