<a> (Anchor) ElementKnow and understand the function of an anchor (<a>) in HTML web pages, how it fits into the three‑layer web‑development model, and how it meets the requirements of the Cambridge IGCSE ICT (0417) syllabus (Sections 21.1‑21.3).
target, rel, download). No scripting language is required for the IGCSE exam.The anchor lives in the content layer but its appearance is set in the presentation layer and its behaviour is controlled by its attributes (behaviour layer).
An HTML document is divided into two main sections:
<meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content="Demo page showing anchor usage"> <meta name="keywords" content="HTML, anchor, link"> <meta name="author" content="Your Name"> <title>Anchor Demo</title> <link rel="stylesheet" href="styles.css">
<div> containers, and the <a> element.All anchors are placed inside the <body>, but their visual style may be defined in the head‑linked CSS file.
An anchor creates a hyperlink that lets a user jump from one location to another. It can link to:
<a href="URL" target="_blank" rel="noopener" title="Link description">Link text</a>
href – destination address (required).target – where the linked document opens (_blank, _self, _parent, _top).rel – relationship; for new‑tab external links use noopener (or noopener noreferrer) for security.title – optional tooltip; improves accessibility and SEO.<a href="https://www.bbc.com" target="_blank" rel="noopener" title="BBC News – world news">BBC News</a>
<a href="#section2">Go to Section 2</a> ... <h3 id="section2">Section 2</h3>
<a href="chapter2.html#summary">Read the summary</a> <h2 id="summary">Summary</h2>
<a href="mailto:info@example.com?subject=Enquiry">Email us</a>
<a href="files/report.pdf" download="AnnualReport.pdf">Download Report</a>
<a href="gallery.html#photo5">
<img src="thumb5.jpg" alt="View photo 5">
</a>
<a href="video.mp4">
<img src="video-thumb.jpg" alt="Play video">
</a>
| Attribute | Purpose | Typical Values / Example |
|---|---|---|
| href | Destination URL or fragment identifier. | https://www.example.com, #section3, chapter2.html#summary |
| target | Where the linked document opens. | _blank, _self, _parent, _top |
| rel | Relationship between current page and linked resource. | noopener, noreferrer, stylesheet, prefetch |
| title | Tooltip / advisory information for accessibility and SEO. | "Visit the official site" |
| download | Indicates the link is for downloading a file. | (empty) or "myfile.zip" |
| id | Creates a named anchor for internal or cross‑page linking. | section5 |
| class | Assigns the element to a CSS class (re‑usable styling). | class="navLink" |
https://www.example.com/images/photo.jpg
images/photo.jpg ../assets/style.css /images/photo.jpg
Links are styled in the **presentation layer**. Remember the CSS hierarchy used in the exam:
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.