All subjects · Information Technology · WIT12 3 hour practical exam on web development with HTML, CSS and JavaScript
HTML document structure: doctype, elements, attributes and the head
Edexcel IAL Information Technology · WIT12 3 hour practical exam on web development with HTML, CSS and JavaScript
Unit 2 is a 3-hour practical exam in which you write HTML, CSS and JavaScript in a plain text editor. Everything starts with a correctly structured HTML document (spec 7.1.1 to 7.1.3).
Elements, tags and attributes (7.1.1)
An HTML document is made of elements. Most elements have an opening tag, content and a closing tag. An attribute goes inside the opening tag and gives extra information as a name="value" pair.
<a href="prices.html">See our prices</a>Here the element is the whole line, <a> is the opening tag, </a> is the closing tag, href="prices.html" is an attribute and 'See our prices' is the content. Some elements are empty (void) and have no closing tag or content, for example <br>, <img>, <meta>, <link>, <input> and <hr>.
The skeleton of every page
Every page has the same outline:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Opening times and prices for the Riverside Sports Centre">
<title>Riverside Sports Centre</title>
<link rel="stylesheet" href="css/style.css">
<script src="js/main.js" defer></script>
</head>
<body>
<h1>Riverside Sports Centre</h1>
<p>Open every day from 7am.</p>
</body>
</html><!DOCTYPE html>is the doctype. It is not an element: it tells the browser the document is HTML5, so it renders in standards mode rather than quirks mode. It must be the very first line.<html>is the root element that contains everything else.<head>holds information about the page;<body>holds what the user sees.
Language declaration (7.1.2)
The lang="en" attribute on <html> declares the language of the page content. Screen readers use it to choose the right pronunciation, browsers use it for spelling checks, hyphenation and translation offers, and search engines use it to serve the page to users of that language. A part of the page in another language can carry its own lang attribute, for example <p lang="fr">Bonjour</p>.
The head element (7.1.3)
The head contains metadata (data about the page), which is not displayed in the page itself:
<meta charset="utf-8">sets the character encoding, so symbols and other alphabets display correctly.<meta name="viewport" ...>makes the page fit the device width: essential for responsive pages.<meta name="description" ...>gives a summary that search engines may show in results.<title>sets the text on the browser tab, in bookmarks and as the clickable heading in search results. It is required.<link>links external files such as a stylesheet;<style>holds internal CSS.<script>adds JavaScript, either inline or from a file with src. The defer attribute makes the browser run the file after the page has been read.
Worked example
A student's page shows the text on the tab as 'Untitled', and accented letters display as strange symbols. Which two lines are missing from the head?
- The tab text comes from the title element, so add `<title>Riverside Sports Centre</title>`.
- Garbled symbols are an encoding problem, so add `<meta charset="utf-8">` as the first line in the head.
Answer: A title element and a meta charset element.
Check yourself
- What is the purpose of `<!DOCTYPE html>` at the start of a page?
- It is the root element that contains the head and body
- It sets the character encoding of the page
- It tells the browser the document is HTML5 so it renders in standards mode
- It links the page to its stylesheet
Show answer
It tells the browser the document is HTML5 so it renders in standards mode. The doctype is a declaration, not an element: it tells the browser which version of HTML to expect (HTML5), so it does not fall back to quirks mode.
- Which element in the head sets the text shown on the browser tab? Type the element name without angle brackets.
Show answer
title. The title element sets the tab text, the bookmark name and the heading of the search result.
- In `<img src="logo.png" alt="Riverside logo">`, what is `alt`?
- A tag
- An element
- An attribute name
- A content model
Show answer
An attribute name. alt is an attribute name; "Riverside logo" is its value. Attributes go inside the opening tag.
- Give one reason for adding `lang="en"` to the html element.
Show answer
Screen readers use it to pronounce the text correctly in the right language.. The language declaration helps screen readers pronounce the words, helps search engines match the page to users of that language and lets browsers offer translation, spelling checks and hyphenation.
- Which of these is a void (empty) element with no closing tag?
- `<title>`
- `<p>`
- `<head>`
- `<meta>`
Show answer
`<meta>`. meta has no content and no closing tag. title, p and head all need closing tags.
- Where should a `<link rel="stylesheet" href="style.css">` element go?
- After the closing html tag
- Inside the head element
- Before the doctype
- Inside a paragraph in the body
Show answer
Inside the head element. link is metadata, so it belongs in the head.
- What does `<meta name="viewport" content="width=device-width, initial-scale=1">` do?
Show answer
It makes the page width match the width of the device screen so it is not zoomed out on a phone.. It sets the layout width to the device width at 100% zoom. Without it, phones display a zoomed-out desktop-width page and media queries do not work as intended.
Sources
- Pearson Edexcel International Advanced Subsidiary/Advanced Level in Information Technology specification (first teaching 2018), Unit 2 Topics 7 to 11
- Pearson qualifications: Edexcel International Advanced Level Information Technology (2018)
Last updated 8 November 2026. Spotted a mistake? Tell us.