Lesson 18: HTML Id
Setting Unique Element Identifiers
The id attribute specifies a unique identifier for an HTML element. An ID value must be unique across the entire page document.
<h1 id="header-main">Unique Header</h1>
Why&How to use:
IDs target specific individual elements for CSS styling, JavaScript manipulation, or bookmark page jump anchors (#section-id).
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>HTML Id</title> <style> #main-header { color: navy; text-transform: uppercase; } </style></head><body> <h1 id="main-header">Main Section Title</h1></body></html>