HTMLHTML14 min read

HTML Id

Use id for unique elements. Useful for linking, CSS, and JavaScript selection.

David Miller
December 22, 2025
1.8k40

id is a unique name for one element.

Example

<h2 id="mainTitle">Dashboard</h2>

Use id for jumping links

<a href="#contact">Go to Contact</a>
<h2 id="contact">Contact</h2>

Preview

Click link → jumps to Contact section.

Important rule

Do not repeat the same id on the same page.

#HTML#Beginner