No announcement
 

ID

The id attribute is used to provide a unique identifier for an HTML element. It should be unique within the entire HTML document.

Example:

id.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>ID Attribute Example</title>
</head>
<body>
    <h1 id="title">Welcome to My Website</h1>
    <p id="description">This is some text on the page.</p>
</body>
</html>


Output

Welcome to My Website

This is some text on the page.

In this example, the id attribute is used to assign the identifier "title" to the <h1> element and the identifier "description" to the <p> element. You can reference these unique identifiers in CSS or JavaScript to apply specific styles or perform targeted actions on these elements.