No announcement


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



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


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.