HTML Id

The HTML id attribute is the unique identifier. Every id’s unique in the entire HTML document. The HTML id’s use for Javascript and CSS (Cascading Style Sheet).

The values ​​of id attributes are case-sensitive. For example id = “z” and id = “Z”, both of these are different.

The values ​​of id attributes start with alphabet.

Id attribute can be alphanumeric, but it is necessary to give hyphen (-) or underscore (_) between alphabet and number.

HTML Id Example

<!DOCTYPE html>
<html>
<head>
<style>
#textid {
    background-color: Red;
}
</style>
</head>

<body>
<div class="textid">
<p>"The HTML id is a very important part of cascading style sheet, the class attribute is used for CSS and Javascript, CSS is used to design the website and most of the class attribute is used in css ."</p>
</div>
</body>

Output

“The HTML id is a very important part of cascading style sheet, the class attribute is used for CSS and Javascript, CSS is used to design the website and most of the class attribute is used in css .”