The id attribute
An id identifies a specific element on a page and should normally be unique within that document.
Learn how websites are structured from the ground up using HTML. Build real pages while learning elements, attributes, links, images, forms, tables, semantic HTML and more.
Lesson 15 of 24
14 min learning time
An id identifies a specific element on a page and should normally be unique within that document.
A class can be shared by multiple elements and is commonly used for styling and JavaScript selection.
<h1 id="page-title">
Vinsoft Lab
</h1>
<p class="description">
Learn technology.
</p>
<p class="description">
Build useful projects.
</p>
Practical Exercise
Create one element with an id and two elements sharing the same class.
Quick Check
Which attribute is commonly shared by multiple elements?