Students can copy a paragraph tag, yet a submitted site mixes content, presentation and behaviour, with styles scattered and every heading at level one. This chapter compresses a site into three lines: structure through tags, appearance through a style sheet, and readability through contrast and alternative text, with page weight turned into arithmetic.
Objectives — Students should be able to: (1) build structure with tags, where a page carries one level-one heading, lists use list tags rather than typed symbols, tables merge cells for a spanning heading, links split into relative, absolute, mailto and in-page anchors, and a 6-page site with 6 navigation links a page holds 36 links that a change touches 6 times; (2) explain the three ways to apply styles and their precedence, where inline beats internal and internal beats external, later rules beat earlier ones at the same level, and selectors in element, class and id avoid editing paragraph by paragraph; (3) work the box model, where content at 600 px plus padding of 20 px a side plus borders of 5 px a side occupies 650 px, while the border-box model keeps the total at 600 px; (4) answer on contrast, where navy #1E4E8C on white gives 8.32 to 1, grey #767676 gives 4.54 to 1 just past 4.5, and light grey #949494 gives 3.03 to 1 for large text only; (5) answer on load time, where HTML at 24 KB plus CSS at 18 KB plus 6 images at 145 KB each gives 912 KB, and 3 Mbps at 375 KB a second loads in 2.43 seconds, while an 800 by 600 image at 24-bit is 1.37 MiB raw and about 140 KB as JPEG.
01 Prerequisites (3-minute check)
If any of these fails, fix it before the lesson starts.
| Skill |
Quick check |
Pass mark |
| Files and folders |
If the same image sits in two folders, will a link still work? |
Relative paths break as soon as a file moves |
| Heading hierarchy |
Why do documents rank headings by size? |
The hierarchy shows structure to readers and to software |
| Unit conversion |
How many KB a second is 3 Mbps? |
Divide by eight, which gives 375 |
02 Lesson flow (60 minutes)
| Time |
Stage |
Tutor does |
Student does |
| 0-8 min |
Opening question |
Ask how one paragraph repeated on ten pages can change everywhere at once, then collect answers |
Write a prediction to check at the end |
| 8-24 min |
HTML structure |
Skeleton, heading levels, paragraphs, lists, tables and four link types |
Write a page with three sections and one table |
| 24-40 min |
Style sheets and the box model |
Three applications, three selectors, precedence, box model and font sizing |
Drive a whole site from one external sheet |
| 40-50 min |
Accessibility and contrast |
Alternative text, unbroken heading order, the contrast formula and the 4.5 floor |
Work one colour pair |
| 50-57 min |
Load time and publishing |
Page weight, image compression, cross-browser and link testing |
Work one load time |
| 57-60 min |
Exit check |
Two questions marked at once, naming the structure, style or accessibility gap |
Work independently |
03 Teaching script (read it out)
Scene 1: Structure: tags say what a thing is, not how it looks
Start with the three layers: content in HTML, presentation in CSS and behaviour in script, and the practical paper tests only the first two, so a request to change a colour never means editing tags. Walk the skeleton from the outside in: the document declaration, the html element, and the head holding a title for the browser tab and meta tags for encoding and description, then the body. Heading levels express structure, so a page has one level-one heading and the rest descend without skipping a level, because assistive tools build an outline from them. Paragraphs use paragraph tags and a line break tag serves a break inside one paragraph, so three lines of text mean three paragraphs rather than three line breaks, which would lose the paragraph spacing that styles control. Lists come as ordered and unordered, and every item is a list item, so numbering is never typed by hand, because inserting one item would then mean renumbering the rest. Tables are rows of cells, with spanning headings made by merging columns or rows, though data rows stay unmerged or sorting and totals break. Links take four forms: a relative path within the site, an absolute address for another site, mailto for email, and an id anchor with a hash for a jump inside the page. Numbers make the maintenance cost concrete: 6 pages with 6 navigation links each hold 36 links, so one new page means editing 6 files, while a shared include or a generated navigation changes one place. One rule to have students say: tags carry meaning and style sheets carry appearance.
Student task: write one page with three sections, one level-one heading, two level-twos, an unordered list and a two-column table with a merged first row. Student talk: state that a page has one level-one heading and the levels never skip.
The scene is secure with correct heading order, list tags and a merged heading row, plus the four link types named.
Scene 2: Styles: one sheet drives the site and the box model sets the real width
Styles apply in three ways chosen by purpose: inline styles sit in a tag attribute and touch one element only, the hardest to maintain; internal styles sit in the page head and touch one page; external styles live in their own file, serve the whole site and change everywhere at once, which is what the practical paper wants to see. Selectors come in three kinds: an element selector covers every tag of a type, a class covers a group of elements and an id targets one unique element. Precedence must be stated flatly: inline overrides internal and external, later rules override earlier rules at the same level, and specificity ranks id above class above element, so ids should not carry styling or later overrides demand more weight. The box model is where marks leak: the space an element occupies equals content width plus left and right padding plus left and right borders, while margin sits outside and pushes neighbours away. With content at 600 px, padding of 20 px a side and borders of 5 px a side, the element occupies 650 px, yet the same declaration under the border-box model stays 600 px because padding and borders grow inwards. Have students work that sum once, then explain the classic two-column failure: two columns at 50 percent each plus padding exceed 100 percent, so the second column drops, and the fixes are the border-box model or padding folded into the percentage. Font sizes work relatively: with a root of 16 px, a level-one heading at 2 rem is 32 px, a level-two at 1.5 rem is 24 px and small text at 0.875 rem is 14 px, so one root change scales the site while absolute pixels need editing one by one. One rule to have students say: anything reusable never goes inline.
Student task: build one external sheet with an element, class and id selector, then repair a two-column layout that overflows. Student talk: state that the occupied width is content plus padding plus border.
The scene is secure with an external sheet, one selector of each kind and the 650 px sum correct.
Scene 3: Accessibility and speed: readability and load time both compute
Accessibility carries few marks and is easy to win, because the rules are short. First, every meaningful image needs alternative text that describes the content rather than saying image; decorative images take empty alternative text so assistive tools skip them. Second, heading order never skips and one level-one heading remains. Third, colour is never the only signal, so an error also carries words or an icon. Fourth, contrast must reach the floor: relative luminance for each colour, then the lighter luminance plus 0.05 over the darker plus 0.05. Navy #1E4E8C on white gives 8.32 to 1, well past 7 to 1 and at the top grade; grey #767676 on white gives 4.54 to 1, just past the 4.5 floor for body text; light grey #949494 gives 3.03 to 1 and serves only large or bold text of 18 pt and above. The same formula runs backwards, so whether a grey is safe is computed rather than guessed. Speed computes too: page weight is HTML plus CSS plus images plus fonts, so 24 KB plus 18 KB plus 6 images at 145 KB gives 912 KB, and 3 Mbps at 375 KB a second delivers it in 2.43 seconds, with a mobile connection three times slower near seven. Hence compression: an 800 by 600 image at 24-bit is 800 times 600 times 3 bytes, or 1.37 MiB raw, and JPEG at ten to one is about 140 KB, saving nine tenths on one image, while logos and icons belong in a vector format that scales without blur. Finish with publishing and testing: after upload, open the site in two browsers, click every link and narrow the window to phone width, and those three checks are the testing marks.
Student task: write alternative text for three images and compute the contrast of one chosen colour pair. Student talk: state that 4.5 to 1 is the floor for body text.
The scene is secure with alternative text written, the 8.32 and 3.03 figures correct and the 2.43 seconds explained.
04 Question types and worked steps
| Type |
Example |
Steps |
Answer |
| Box model width |
Content 600 px, padding 20 px, border 5 px |
Content plus both paddings plus both borders |
650 px |
| Contrast ratio |
Navy #1E4E8C on white, light grey #949494 on white |
Lighter plus 0.05 over darker plus 0.05 |
8.32 to 1 passing, 3.03 to 1 for large text only |
| Page weight and load |
912 KB on 3 Mbps |
Total KB over KB a second |
2.43 seconds |
| Image file size |
800 by 600 at 24-bit |
Pixels times bytes a pixel, then convert |
1.37 MiB, about 140 KB as JPEG |
Sanity check (teach this): Sanity checks: under the content-box model the occupied width exceeds the declared width, so 600 plus 20 twice plus 5 twice gives 650, and an answer of 600 means the border-box model was assumed. A contrast ratio is at least 1, with white on white at 1 and black on white at 21, so 0.8 means the division inverted. Load time is total bytes over bandwidth with units aligned, so 912 KB at 375 KB a second gives 2.43 seconds, and 0.3 seconds means the factor of eight was dropped. File size is pixels times bytes a pixel, so 800 by 600 by 3 gives 1.37 MiB, and using 4 means 32-bit colour was assumed. List items equal list item tags, and in a table the cells plus merges in each row equal the column count, so a mismatch means a broken merge.
05 Independent practice (3 questions)
| Question |
Answer |
What to watch |
| Calculation |
Content 500 px with 16 px padding and 4 px borders a side: find the occupied width |
Content plus both paddings plus both borders |
540 px |
| Calculation |
A 1,200 KB page on 600 KB a second: find the load time |
Total KB over KB a second |
2.0 seconds |
| Calculation |
640 by 480 at 24-bit: find the uncompressed file size |
Pixels times 3 bytes, then divide by 1024 |
921,600 bytes or 900 KiB |
06 Common mistakes and what to say
| Mistake |
Student writes |
Say this |
| Using line breaks for paragraphs |
Saying a few breaks make the text look like three paragraphs |
It looks close yet there is no paragraph spacing and styles cannot reach it, so three paragraphs take three paragraph tags. |
| Making every heading level one |
Using level one throughout because the size looks convenient |
A page allows one level-one heading and the rest descend, since all level one means no outline and no contents. |
| Styling each tag in place |
Writing colour and size into every paragraph |
One change then means dozens of edits, so move the rules into an external sheet with class selectors. |
| Conveying state by colour alone |
Marking errors red and correct answers green |
Colour blind users cannot separate them and a black and white print loses the meaning, so add words or an icon and reach 4.5 to 1. |
07 Homework (paper, section and question numbers)
08 Exit check (last 5 minutes)
| Question |
Answer |
Decision |
| One rule |
One level-one heading a page, with no skipped levels |
A miss sends scene one back |
| One formula |
Occupied width is content plus padding plus border |
A wrong sum sends scene two back |
| One floor |
Body text needs 4.5 to 1 contrast |
A miss sends scene three back |
09 Tutor FAQ
Why does an edited external sheet change nothing?
Usually a wrong path or a cache, so check the relative path first, force a reload, and only then check the selector.
Why do two 50 percent columns drop to a second line?
Padding and borders add outside the 50 percent so the total passes 100 percent, which the border-box model or folded padding fixes.
Does every image need alternative text?
Every meaningful image does and the text describes the content, while decorative images take empty alternative text so tools skip them.
Find a tutor — freeTutor Registration →
A TutorZone lesson-prep guide. Written by the TutorZone team; questions and lesson flow are original and are not taken from any school or publisher material.