id attribute (recommended)<h2 id="chapter3">Chapter 3: Data Types</h2>
<a href="#chapter3">Go to Chapter 3</a>
name attribute (deprecated – kept only for legacy support)<a name="section2"></a>
<a href="#section2">Jump to Section 2</a>
id<section id="faq">
<h2>Frequently Asked Questions</h2>
…
</section>
<a href="#faq">Read the FAQ</a>
<a href="guide.html#installation">Installation Instructions</a>
| Element | Purpose |
|---|---|
<title>…</title> | Page title shown in the browser tab. |
<meta charset="UTF-8"> | Specifies character encoding. |
<meta name="description" content="…"> | Search‑engine summary. |
<meta name="keywords" content="…"> | Optional keyword list. |
<meta name="viewport" content="width=device-width, initial-scale=1"> | Responsive design on mobile devices. |
<link rel="stylesheet" href="css/style.css"> | Links an external CSS file (presentation layer). |
div and semantic elements<body>
<header>
<h1>My Tutorial</h1>
</header>
<nav role="navigation" aria-label="Page bookmarks">
<ul>
<li><a href="#intro">Introduction</a></li>
<li><a href="#chapter3">Chapter 3</a></li>
<li><a href="#faq">FAQ</a></li>
</ul>
</nav>
<main>
<section id="intro">
<h2>Introduction</h2>
…
</section>
<section id="chapter3">
<h2>Chapter 3: Data Types</h2>
…
</section>
<section id="faq">
<h2>Frequently Asked Questions</h2>
…
</section>
</main>
<footer>
<p>© 2025 My Site</p>
</footer>
</body>
<table border="1">
<thead>
<tr><th>Feature</th><th>Supported</th></tr>
</thead>
<tbody>
<tr><td>Bookmarks</td><td>Yes</td></tr>
<tr><td>Audio</td><td>Yes</td></tr>
</tbody>
</table>
<img src="images/logo.png" alt="Company logo" width="120">
<audio controls>
<source src="media/lecture.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<video controls width="480">
<source src="media/demo.mp4" type="video/mp4">
Your browser does not support the video element.
</video>
<a href="page.html">Link to another page</a>
<a href="https://www.example.com" target="_blank" rel="noopener">External site (opens in new tab)</a>
<a href="files/guide.pdf" download>Download guide (PDF)</a>
href="css/style.css"href="../images/photo.jpg"
href="https://www.example.com/css/style.css"
Use absolute URLs only for external resources; never for files that belong to the same website.
<link rel="stylesheet" href="css/style.css">
| Selector type | Specificity | Example |
|---|---|---|
| Element | 0‑0‑1 | p {margin:0;} |
| Class | 0‑1‑0 | .section {font-family:Arial;} |
| ID | 1‑0‑0 | #intro {background:#f0f0f0;} |
| Inline style | 1‑0‑0‑1 | style="color:red;" |
Higher specificity overrides lower. When specificity is equal, the rule that appears later in the stylesheet wins.
link).<style> in the head)./* external file: css/style.css */
body {font-family:Helvetica,Arial,sans-serif; line-height:1.6; margin:0;}
/* navigation list */
nav ul {list-style:none; padding:0; margin:0; display:flex; gap:1rem;}
nav a {color:#0066cc; text-decoration:none;}
nav a:hover {text-decoration:underline;}
/* sections */
section {margin:2rem 0; padding:1rem; border-left:4px solid #ddd;}
#faq {background:#fafafa;}
/* tables */
table {border-collapse:collapse; width:100%;}
th, td {border:1px solid #ccc; padding:0.5rem; text-align:left;}
contact-form); each ID must be unique on the page.alt="Company logo").<nav role="navigation" aria-label="Page bookmarks"> to aid screen‑reader users.target="_blank" always add rel="noopener" to prevent the new page from gaining access to the original window.| Method | Target element | HTML example | Notes |
|---|---|---|---|
id attribute (recommended) | Any element (h2, section, div, …) | <h2 id="intro">Introduction</h2> | Unique, lower‑case, hyphenated IDs. |
name attribute (deprecated) | Empty <a> element | <a name="top"></a> | Only for legacy support. |
Semantic element with id | <section>, <article>, <nav> … | <section id="faq">…</section> | Improves structure and accessibility. |
| Cross‑page bookmark | Any element with an id on the target page | <a href="guide.html#installation">Installation</a> | Combine page URL with a hash. |
id to linking with #id (include in slide deck).
Your generous donation helps us continue providing free Cambridge IGCSE & A-Level resources, past papers, syllabus notes, revision questions, and high-quality online tutoring to students across Kenya.