By the end of this lesson students will be able to:
| Layer | Purpose | Typical Technology |
|---|---|---|
| Content | Structure and meaning of information | HTML |
| Presentation | How the content looks – layout, colours, fonts, etc. | CSS |
| Behaviour | Interaction and dynamic effects | JavaScript (not examined for IGCSE ICT 0417) |
What the exam expects you to know
<!DOCTYPE html><html lang="en">
<head>
<meta charset="utf-8"> <!-- required -->
<meta name="viewport" content="width=device-width, initial-scale=1"> <!-- required for mobile -->
<title>My First Web Page</title> <!-- required – one per page -->
<!-- Optional meta data – useful for SEO -->
<meta name="description" content="Brief description of the page">
<meta name="keywords" content="HTML, CSS, IGCSE">
<!-- Internal stylesheet (optional) -->
<style>
/* CSS goes here */
</style>
<!-- External stylesheet – recommended for larger projects -->
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<!-- Page content goes here -->
</body>
</html>
<h1> … </h1> to <h6><p><ol>, unordered <ul>, definition <dl><thead>, <tbody>, <th>, colspan, rowspanalt text for accessibilitycontrols attributemailto:<div> for layout, plus optional semantic tags (<header>, <nav>, <section>, <footer>)While the syllabus only requires <div>, using semantic elements makes the markup clearer and improves accessibility.
<header>…</header><nav>…</nav>
<section>…</section>
<article>…</article>
<footer>…</footer>
<img> must have an alt attribute that describes the image.<h1> only once per page.<h1 style="color:red;">Title</h1><style> block in the <head>.css file linked with <link rel="stylesheet" href="css/styles.css">selector {property: value;
property: value;
}
Example – make every paragraph blue:
p {color: blue;
}
| Source | Order of Precedence (low → high) |
|---|---|
| Browser default styles | 1 |
| External stylesheet | 2 |
| Internal stylesheet | 3 |
| Inline style attribute | 4 |
Specificity is calculated as inline‑style, ID, class/attribute/pseudo‑class, element/pseudo‑element (a‑b‑c‑d). The higher the number, the stronger the rule.
| Selector Type | Specificity Value (a‑b‑c‑d) |
|---|---|
Element (e.g., p) | 0‑0‑0‑1 |
Class, attribute or pseudo‑class (e.g., .note, [type="text"], :hover) | 0‑0‑1‑0 |
ID (e.g., #header) | 0‑1‑0‑0 |
| Inline style attribute | 1‑0‑0‑0 |
Example – overriding an external rule with an inline style
/* external.css */p { color: green; } /* specificity 0‑0‑0‑1 */
/* inline on the element */
<p style="color: red;">Text</p> /* overrides because 1‑0‑0‑0 > 0‑0‑0‑1 */
css/styles.css).https://example.com/css/main.css)./* element selector */h1 { … }
/* class selector */
.box { … }
/* ID selector */
#menu { … }
/* descendant selector */
nav ul li { … }
/* group selector */
h1, h2, h3 { … }
.box {width: 200px; /* content width */
padding: 10px; /* inside the border */
border: 2px solid #333;
margin: 15px; /* outside the border */
}
.highlight {background-color: #ffeb3b;
color: #000;
text-decoration: underline;
}
em – relative to the current font size.rem – relative to the root (html) font size.% – relative to the parent element’s dimension.Simple responsive container example (exam‑friendly):
.container {width: 90%; /* 90 % of the viewport width */
max-width: 1200px; /* never wider than 1200 px */
margin: 0 auto; /* centre horizontally */
padding: 1rem;
}
<ol>)| Property | Typical values | Effect |
|---|---|---|
list-style-type | decimal, lower-alpha, upper-roman, … | Changes the numbering format. |
list-style-position | inside, outside | Places the marker inside or outside the list‑item box. |
margin-left | any length (e.g., 2em) | Indents the whole list. |
/* Roman‑numeral ordered list, markers inside */ol.roman {
list-style-type: upper-roman;
list-style-position: inside;
margin-left: 2em;
}
<ul>)| Property | Typical values | Effect |
|---|---|---|
list-style-type | disc, circle, square, none | Changes the bullet shape. |
list-style-image | url('bullet.png') | Uses a custom image as the bullet. |
list-style-position | inside, outside | Controls where the bullet appears. |
/* Square‑bullet unordered list, markers outside */ul.square {
list-style-type: square;
list-style-position: outside;
margin-left: 1.5em;
}
/* Keep marker black, but make list‑item text blue */ul.coloured li {
color: blue; /* text colour */
}
ul.coloured {
color: black; /* marker colour */
}
list-styles.html.<head> add an internal stylesheet that defines:.roman – ordered list using upper-roman markers..bullet – unordered list using circle markers..container – centres the page, adds padding and demonstrates a responsive layout.<body> create a <div class="container"> and place:<h1> title.roman.bullet.list-style-position from outside to inside and note the visual difference.list-style-image.<style>.container {
max-width: 800px;
margin: 0 auto;
padding: 1rem;
font-family: Arial, sans-serif;
background-color: #f9f9f9;
}
/* Ordered list – Roman numerals */
ol.roman {
list-style-type: upper-roman;
list-style-position: outside;
margin-left: 2em;
}
/* Unordered list – Circle bullets */
ul.bullet {
list-style-type: circle;
list-style-position: outside;
margin-left: 1.5em;
}
</style>
charset and viewport meta‑tags; title is mandatory.alt attribute; link text must be meaningful.<div> or semantic tags for layout; classes reusable, IDs unique.em, rem, %. Use a container with width:90%; max-width:1200px; for exam‑style layouts.list-style-type (decimal, upper‑roman, disc, circle, square, none).list-style-position (inside / outside).list-style-image for custom bullets.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.