HTML ID Attribute

Id is one of the attributes of an element. Each HTML element can have an identifier (id), which must be unique in the whole document, to separate it from other elements.



Each HTML element can have an identifier (id), which must be unique in the whole document, to separate it from other elements.
Usually JavaScript and CSS deal with element id.
For example, if any javascript function wants to invoke the element, it can call the element using the element identifier.
And the style sheet can assign specific style to the element using the element identifier.

Id is one of the attributes of an element.

<tag id="something">Element Content</tag>

View in Code Editor

<< : HTML Style HTML Class Attribute : >>