All subjects · Information Technology · WIT12 3 hour practical exam on web development with HTML, CSS and JavaScript
CSS: purpose, inline, internal and external style sheets, and rules
Edexcel IAL Information Technology · WIT12 3 hour practical exam on web development with HTML, CSS and JavaScript
CSS (Cascading Style Sheets) controls how HTML looks. You need to know why it is used, the three ways to add it, and how a rule is written (spec 8.1.1 to 8.1.3).
Why CSS (8.1.1)
HTML describes the structure and meaning of content; CSS describes its presentation: colours, fonts, spacing and layout. Keeping them separate means:
- control of layout: position elements precisely and change the layout for different screen sizes
- consistent design: one style sheet styles every page, so headings, colours and menus match across the site
- easier maintenance: change one rule and every page updates
- smaller, faster pages, because the style sheet is downloaded once and cached
Three ways to add CSS (8.1.2)
<!-- 1 Inline: a style attribute on one element -->
<p style="color: navy;">Opening times</p>
<!-- 2 Internal: a style element in the head -->
<style>
p { color: navy; }
</style>
<!-- 3 External: a separate .css file linked in the head -->
<link rel="stylesheet" href="css/style.css">| Method | Affects | Strengths and weaknesses |
|---|---|---|
| Inline | One element | Quick for a single change, but mixes style with content and must be repeated on every element; highest priority |
| Internal | One page | Useful for a single page or a page-specific style, but other pages cannot share it |
| External | Every page that links to it | One file controls the whole site: consistent, easy to update, cached by the browser. Best practice |
Files, folders and rules (8.1.2, 8.1.3)
External style sheets are usually kept in a folder such as css, named in lower case without spaces (style.css), and linked with a relative path (css/style.css, or ../css/style.css from a page in a subfolder). If you save a style sheet under a new name, such as Q04FINISHED.css, update the href in the link element: Pearson's 2025 report noted pages that lost their styling because the link still pointed to the old name.
A CSS rule has a selector and a declaration block of property: value pairs, each ending with a semicolon:
h1 {
color: #003366;
font-size: 2em;
}Here h1 is the selector, color and font-size are properties, and #003366 and 2em are values. A comment is written /* like this */.
Worked example
A site has 40 pages. The client wants every heading changed from blue to green. Compare the work needed with inline styles and with an external style sheet.
- Inline: every h1 on every page has its own style attribute, so up to 40 or more edits, with the risk of missing some.
- External: one rule, h1 { color: green; }, in one file updates all 40 pages at once.
Answer: An external style sheet makes the change once and keeps the site consistent.
Check yourself
- What is the main advantage of an external style sheet over an internal one?
- It always overrides inline styles
- One file can style every page of the site, so a change is made once
- It does not need a link element
- It can only style one element
Show answer
One file can style every page of the site, so a change is made once. An external sheet is shared by every page that links to it.
- In the rule `p { text-align: center; }`, what is the property? Type it exactly.
Show answer
text-align. text-align is the property and center is its value; p is the selector.
- Which element links an external style sheet?
- `<style src="style.css">`
- `<link rel="stylesheet" href="style.css">`
- `<script href="style.css">`
- `<css link="style.css">`
Show answer
`<link rel="stylesheet" href="style.css">`. link with rel="stylesheet" goes in the head.
- Describe one difference between an internal and an external style sheet.
Show answer
An internal style sheet is in a style element in the head and only styles that page, whereas an external style sheet is a separate file that can style many pages.. Internal: inside a style element in the page's head, affects only that page. External: a separate .css file linked to any number of pages, so the site stays consistent.
- A student saves the stylesheet as Q04FINISHED.css but the page loses all its styling. What is the most likely cause?
- The link element's href still names the old file
- CSS files cannot have capital letters
- The page needs an internal style sheet as well
- The doctype is wrong
Show answer
The link element's href still names the old file. The href must name the file actually saved.
- Which rule is written correctly?
- h2 ( color: red, font-size: 20px )
- h2 { color = red; font-size = 20px; }
- h2 { color: red; font-size: 20px; }
- { h2: color red; }
Show answer
h2 { color: red; font-size: 20px; }. Selector, curly brackets, property: value pairs separated by semicolons.
- Which way of adding CSS affects only a single element?
- An inline style attribute
- An internal style sheet
- An external style sheet
- A CSS framework
Show answer
An inline style attribute. Inline CSS is written in the element's style attribute.
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)
- Pearson WIT12/01 examiner report, June 2025 series
Last updated 8 November 2026. Spotted a mistake? Tell us.