The id attribute
The id attribute specifies a unique identifier for the tag so that it can be referenced via CSS.
The names id must be typed in English letters, numbers, without spaces. The value of the id attribute must not begin with a number (this is already possible in HTML5, but will not work in older browsers).
Example
Let's now set the paragraph that has an attribute with id set to elem to have red text color:
<p id="elem">text</p>
<p>text</p>
#elem {
color: red;
}
:
See also
-
attribute
class,
which assigns classes to elements