All subjects · Information Technology · WIT12 3 hour practical exam on web development with HTML, CSS and JavaScript

Hyperlinks: internal, external, email, new tab and anchors

Edexcel IAL Information Technology · WIT12 3 hour practical exam on web development with HTML, CSS and JavaScript

Links join pages together. The specification lists six kinds you must be able to write (spec 7.2.5), and examiners have reported lost marks on email links and anchors.

Practise this in the app: instant marking and a fix for every mistake. Free, no email needed to start.

Practise this lesson

Six kinds of link

LinkExample hrefNotes
Internal (another page on the same site)about.html or pages/contact.htmlA **relative** path from the current file: no http
External (another website)https://www.example.comAn **absolute** URL including the protocol
Emailmailto:info@example.comOpens the user's email program
Open in a new window or tabwith target="_blank"Add rel="noopener" for security; tell users it opens a new tab
A part of the same page#pricesJumps to the element with id="prices"
A specific part of another pagetimetable.html#saturdayThe page, then # and the id

Writing them

<a href="classes.html">Our classes</a>
<a href="https://www.example.com">Example site</a>
<a href="mailto:bookings@example.com">Email the bookings team</a>
<a href="https://www.example.com" target="_blank" rel="noopener">Opens in a new tab</a>
<a href="#prices">Jump to prices</a>
<a href="timetable.html#saturday">Saturday timetable</a>

<h2 id="prices">Prices</h2>

A same-page link needs two parts: an id on the destination element, and href="#" plus that id on the link. A common exam error is to put the id on the link itself, or to forget the #.

Relative paths

Relative paths describe where a file is from the current file:

Examiners report candidates losing marks for absolute paths to files on their own desktop (for example C:/Users/...): once the work is submitted, those files cannot be found, so images and links break. Always use relative paths in the exam.

Good link text

Link text should make sense on its own ('Download the timetable', not 'click here'): screen reader users often list all the links on a page. Make links visibly different from other text, and style their states with CSS (a:hover, a:focus).

Worked example

A page help.html has a section `<section id="contact">`. Write a link on index.html (in the same folder) that opens help.html at that section.

  1. The target is another page in the same folder, so the path is help.html.
  2. To jump to a part of it, add # and the id: help.html#contact.

Answer: `<a href="help.html#contact">Contact help</a>`

Key idea: Internal links use relative paths; external links use full URLs; email uses mailto:; target="_blank" opens a new tab; #id jumps to an element with that id, page.html#id to part of another page.

Check yourself

  1. Which href creates an email link?
    • email:sales@example.com
    • mailto:sales@example.com
    • https://sales@example.com
    • #sales@example.com
    Show answer

    mailto:sales@example.com. Email links use the mailto: scheme.

  2. A heading is `<h2 id="faq">FAQ</h2>`. Which link jumps to it from the same page?
    • `<a href="faq">FAQ</a>`
    • `<a id="#faq">FAQ</a>`
    • `<a name="faq" href="faq">FAQ</a>`
    • `<a href="#faq">FAQ</a>`
    Show answer

    `<a href="#faq">FAQ</a>`. href="#faq" points to the element whose id is faq. Without the # the browser looks for a file called faq.

  3. What value of the target attribute makes a link open in a new tab or window? Type the value exactly.
    Show answer

    _blank. target="_blank" opens the link in a new browsing context (tab or window).

  4. A page is in the site's root folder. A picture is saved in the images folder inside it. Which src is a correct relative path?
    • C:/Users/student/Desktop/images/pool.jpg
    • /images/pool.jpg/
    • images/pool.jpg
    • pool.jpg/images
    Show answer

    images/pool.jpg. A relative path from the root folder is the folder name, a forward slash and the file name. Desktop paths break when the work is moved or submitted.

  5. Examiners report that some candidates lost marks because images 'did not display' after submission. Explain why using an absolute path to a file on the candidate's desktop causes this.
    Show answer

    The path points to a location on the candidate's own computer, so when the folder is moved or submitted the file is not found at that location and the image does not load.. An absolute path names a fixed place on one machine. On the examiner's computer that place does not exist, so the browser cannot find the file. A relative path works wherever the folder is copied.

  6. Which link is an external link?
    • `<a href="news.html">News</a>`
    • `<a href="#news">News</a>`
    • `<a href="https://www.example.org/news">News</a>`
    • `<a href="../news.html">News</a>`
    Show answer

    `<a href="https://www.example.org/news">News</a>`. External links give the full URL of another website, including the protocol.

Practise with instant feedback

Sources

Last updated 8 November 2026. Spotted a mistake? Tell us.