HTML (structure, text, images, tables, multimedia).CSS (colours, fonts, layout, visual effects).For Cambridge IGCSE 0417 the exam only requires knowledge of the content and presentation layers.
Cascading Style Sheets (CSS) is a language that tells the browser how HTML (or XML) elements should be displayed – colour, font, spacing, positioning, etc.
When more than one rule could apply to an element, the browser decides which rule wins by looking at three factors, in this order:
!important override normal rules.<head> SectionCambridge expects the following tags to be present in every page that uses an external stylesheet.
| Tag | Purpose (as required by the syllabus) |
|---|---|
<meta charset="utf-8"> | Specifies UTF‑8 character encoding (mandatory for all modern pages). |
<meta name="viewport" content="width=device-width, initial-scale=1"> | Ensures the page scales correctly on mobile devices. |
<meta name="description" content="…"> | Provides a short summary for search‑engine results. |
<meta name="keywords" content="…"> | Lists relevant keywords (optional but useful). |
<meta name="author" content="Your Name"> | Identifies the page’s author. |
<title>…</title> | Text shown on the browser tab and in search results. |
<link rel="stylesheet" href="css/style.css"> | Links an external CSS file (the presentation layer). |
<link> element inside the <head> of every page that needs the stylesheet.css/style.css) so the site works on any computer or server.file:///C:/mySite/css/style.css or https://mydomain.com/style.css) ties the page to a specific location or domain, breaking portability and causing case‑sensitivity problems on many web servers..css extension – e.g. style.css. my‑style.css).css/.A rule consists of a selector followed by a declaration block.
| Part | Purpose | Example |
|---|---|---|
| Selector | Identifies which HTML element(s) the rule applies to. | p, #header, .menu |
| Declaration block | One or more property: value pairs, each ending with a semicolon. | { color: red; font-size: 14px; } |
| Property | The visual aspect to change. | color, margin, background-color |
| Value | The setting applied to the property. | red, 10px, #f0f0f0 |
color – text colour.background-color – background colour of an element.font-family, font-size, font-weight, font-style.text-align, text-decoration, line-height, vertical-align.margin and padding – space outside and inside the border.border – style, width, colour of the element’s border.width and height.display – block, inline, inline‑block.<div>, Classes and IDsThe <div> element is a generic container. Styling is applied via a class (.className) or an ID (#idName).
<!-- HTML --><div class="container">
<h2>Section heading</h2>
<p>Some paragraph text.</p>
</div>
/* CSS */
.container {
max-width: 960px;
margin: 0 auto; /* centre horizontally */
padding: 20px;
background-color: #fafafa;
border: 1px solid #ddd;
}
Tables belong to the content layer but are styled in the presentation layer.
<!-- HTML table example --><table class="data">
<caption>Student Scores</caption>
<thead>
<tr>
<th>Name</th>
<th>Score</th>
</tr>
</thead>
<tbody>
<tr>
<td>Alice</td>
<td>85</td>
</tr>
<tr>
<td>Bob</td>
<td>78</td>
</tr>
</tbody>
</table>
/* CSS for the table */
table.data {
width: 100%;
border-collapse: collapse; /* removes double borders */
margin-top: 20px;
}
table.data caption {
caption-side: top;
font-weight: bold;
margin-bottom: 8px;
}
table.data th,
table.data td {
border: 1px solid #999; /* equivalent to cellspacing */
padding: 8px; /* equivalent to cellpadding */
text-align: left;
}
table.data th {
background-color: #e0e0e0;
}
<a href="#section2">Go to Section 2</a><a href="https://example.com" target="_blank">External site</a><a href="mailto:info@example.com">Send email</a>css/style.css or ../images/logo.png).https://mydomain.com/css/style.css).
Use only when linking to resources on another domain; never for files stored locally because it prevents the site from working on a different computer or web server.
.css (lower‑case, no spaces).<link rel="stylesheet"> element is placed inside the <head> of every page that needs the stylesheet.href attribute points to the correct relative location.;) and each rule ends with a closing brace (}).<img src="photo.jpg" alt="Descriptive text"> – alt provides alternate text for accessibility and when the image cannot be displayed.<audio controls src="sound.mp3">Your browser does not support audio.</audio><video controls width="640" src="movie.mp4">Your browser does not support video.</video>website.website create a sub‑folder css.index.html with the following structure:<h1>).<caption> and at least two rows of data).<div class="container">.css/style.css and write CSS rules to:Verdana, size 14px, colour #555555.index.html in a browser and verify that all styles are applied as intended.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.