1. IDs in HTML and CSS

HTML:

An ID is a unique identifier for a single HTML element.

It is defined using the id attribute

<div id="header">This is the header</div>

CSS:

In CSS, an id is targeted using the # symbol followed by the ID name

#header {
    background-color: blue;
    color: white;
}

Key Points:


2. Classes in HTML and CSS

HTML:

A class is a reusable identifier for one or more HTML elements.

It is defined using the class attribute: