Loading

Id

  • The  id is used to uniquely identify an HTML element, which is crucial for various purposes, including styling with CSS, scripting with JavaScript, and creating anchors for linking to specific parts of a webpage.

Key Points:

  • Id names are case-sensitive.
  • The id should be unique.

Example:

<!DOCTYPE html>
<html>

<head>
    <title>Class</title>
    <style>
        #main-heading {
            background-color: beige;
            color: rgb(203, 32, 9);
        }

        #paragraph {
            border: 2px solid yellow;
        }
    </style>
</head>

<body>
    <h1 id="main-heading">Welcome to our Website</h1>
    <p id="paragraph">Thank You</p>
</body>

</html>

Output: