By the end of this lesson you will be able to create hyperlinks that:
download, rel, title, aria‑label) for security and accessibility.Every HTML document consists of two main sections:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My Web Page</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
…content goes here…
</body>
</html>
These are the building blocks you will use most often. The syllabus also expects you to recognise the semantic elements that give meaning to page sections.
| Element | Purpose | Example |
|---|---|---|
<h1>–<h6> | Document headings – hierarchical structure. | <h2>Features</h2> |
<p> | Paragraph of text. | <p>Welcome to our site.</p> |
<ul>, <ol>, <li> | Unordered / ordered lists. | <ul><li>Item</li></ul> |
<table> | Tabular data – use <thead>, <tbody>, <tr>, <th>, <td>. | <table> |
<img> | Embedded image – requires src and alt. | <img src="logo.png" alt="School logo"> |
<audio>, <video> | Multimedia playback. | <audio src="song.mp3" controls></audio> |
<div>, <span> | Generic containers – div for block‑level, span for inline. Use class or id for styling. | <div class="feature">…</div> |
<section>, <article>, <nav>, <header>, <footer> | Semantic elements that describe the role of a block of content. | <nav><a href="index.html">Home</a></nav> |
<a> Element<a href="destination">Link text</a>
The href attribute defines the destination. All other attributes are optional but often essential for usability, security or accessibility.
| Attribute | Purpose | Typical Values / Example |
|---|---|---|
href | Target URL or fragment identifier. | href="page2.html" or href="#section3" |
target | Where the link opens (see 3.4). | target="_blank" |
download | Force download of the linked resource. | download="report.pdf" |
rel | Relationship to the linked document; also used for security with _blank. | rel="noopener noreferrer" |
title | Tooltip text shown on hover. | title="Read the full article" |
aria-label | Accessible name for screen‑reader users. | aria-label="Open PDF in new tab" |
Bookmarks are created with an id (or the legacy name) on any element.
<h2 id="features">Features</h2>
<a href="#features">Jump to Features</a>
target| Value | Effect | Security / Accessibility Note |
|---|---|---|
_self | Opens in the same tab/window (default). | – |
_blank | Opens in a new, unnamed tab/window. | Always add rel="noopener noreferrer". Indicate in the link text that a new tab will open. |
_parent | Opens in the parent frame (relevant only with framesets). | Rarely needed in modern sites. |
_top | Breaks out of all frames and loads in the full window. | Same security considerations as _blank. |
myWindow (any custom name) | Opens in a named window; creates it if it does not exist. | Useful for pop‑up style windows, but ensure the user can control the behaviour. |
<a href="about.html">About us</a>
<a href="/resources/help.html">Help</a>
<a href="https://www.bbc.com">BBC News</a>
Remember: a leading “/” points to the server root; omit it for a true relative link.
Links can use any valid URI scheme, not just http or mailto.
<a href="mailto:support@example.com?subject=Help%20request">Email Support</a>
<a href="tel:+441234567890">Call us</a>
<a href="ftp://ftp.example.com/file.zip">Download via FTP</a>
<a href="large-photo.html" target="_blank" rel="noopener">
<img src="thumb.jpg" alt="Thumbnail of large photo">
</a>
Wrap the <img> inside the <a>. Provide meaningful alt text; add aria-label if the image alone does not convey the purpose.
<style>
a:link { color:#0066cc; text-decoration:none; } /* unvisited */
a:visited { color:#663399; } /* visited */
a:hover { color:#ff6600; text-decoration:underline; } /* mouse over */
a:active { color:#cc0000; } /* while clicking */
</style>
These pseudo‑classes help users recognise link status and improve accessibility.
https:// or http://.%20. Use lower‑case letters only._blank – always add rel="noopener noreferrer".aria-label where needed.name attribute for anchors – use id instead.<nav>, <header>, <footer>, <section>, <article> where appropriate.mailto:, tel: and other schemes launch the appropriate application.For the IGCSE exam, JavaScript or other scripting languages are not required for hyperlink tasks. All required functionality can be achieved with pure HTML (and optional CSS for presentation).
href (bookmark, file path, URL, or other URI scheme).id when creating same‑page bookmarks.target value; add rel="noopener noreferrer" when using _blank.download, title, aria-label) for usability, security, and accessibility.<a> tags to make them clickable.<nav>, <header>, <section>…) where appropriate.Create three pages: index.html, about.html, contact.html. Implement the features below, then validate each page.
about.html that opens in the same window.contact.html that opens in a new named window called contactWin.info@school.edu with the subject “Inquiry”.<header>, <nav>, <section>, and <footer>.index.html using a relative link.mailto: link with pre‑filled subject and body.tel: link for a phone number.target="_blank" with rel="noopener noreferrer" for any external links.title or aria-label where needed).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.