Year 8 · Autumn 2
Building the Web · Lesson 5 of 5
Build a one-page wiki about a favourite game
ProjectTopic 16 The web
Year 8 · Building the Web · Lesson 5 of 5
You will learn to
- Use a written spec as a checklist before, during and after building.
- Create a one-page wiki that meets the spec: heading, three sections, image with alt text, list, link and stylesheet.
- Identify and fix tags that are missing, misspelt, in the wrong order or not closed.
- Explain why a few tags, like img, never have a closing tag.
Year 8 · Building the Web · Lesson 5 of 5
Success criteria
You have got it when you can say:
- I can tick off every line of the spec on my finished page.
- I can find and fix at least two errors in my HTML.
- I can show that my stylesheet is linked, because the page changes when I edit style.css.
Year 8 · Building the Web · Lesson 5 of 5
Retrieval starter
Questions from before. Write your answers, then show them.
- Last lesson
Which controls how a page looks?
A DNSB HTMLC CSS
C. CSS
- Last unit
In AQA notation, what does A + B mean?
A A AND BB A OR BC A add B
B. A OR B
- Earlier this unit
404 means…
A Not foundB The server crashedC OK
A. Not found
Year 8 · Building the Web · Lesson 5 of 5
Key words
- URL
- The full web address of something online.
- Protocol
- A set of agreed rules for communication.
- HTML
- Markup language for the content of web pages.
- CSS
- Language that styles how web pages look.
The explanation · step 1 of 4 · part 1 of 2
The spec is your checklist
A spec (short for specification) is a list of what the finished work must have.
Read the spec before you start. Check it again at the end.
| Spec line | The HTML that does it |
|---|---|
| A main heading | <h1> |
| Three sections | Three <h2> headings, each with some content under it |
| An image with alt text | <img src="…" alt="…"> |
| A list | <ul> with an <li> for each item |
| A link | <a href="…"> |
| A stylesheet | <link rel="stylesheet" href="style.css"> in the head |
The explanation · step 1 of 4 · part 2 of 2
The spec is your checklist (continued)
Build one line of the spec at a time. Save, refresh the browser, and check it before the next line.
The explanation · step 2 of 4 · part 1 of 5
The whole page
Here is a finished wiki page. Every spec line is in it.
<!DOCTYPE html> <html lang="en-GB"> <head> <meta charset="utf-8"> <title>Tetris: a fan wiki</title> <link rel="stylesheet" href="style.css"> </head>
The explanation · step 2 of 4 · part 2 of 5
The whole page (continued)
<body>
<h1>Tetris</h1>
<img src="tetris.png" alt="Coloured blocks falling into a stack">
<h2>What it is</h2>
<p>A puzzle game made by Alexey Pajitnov in 1984.</p>
<h2>How to play</h2>
<ul>
<li>Turn and move the falling blocks.</li>
<li>Fill a whole row to clear it.</li>
<li>Stop the stack reaching the top.</li>
</ul>The explanation · step 2 of 4 · part 3 of 5
The whole page (continued)
<h2>Find out more</h2> <p><a href="https://en.wikipedia.org/wiki/Tetris">Tetris on Wikipedia</a></p> </body> </html>
The explanation · step 2 of 4 · part 4 of 5
The whole page (continued)
<!DOCTYPE html>tells the browser this is a modern HTML page.lang="en-GB"says the page is in British English. Screen readers use it to choose a voice.- The head holds information about the page. You do not see it on the page itself.
<meta charset="utf-8">lets the page show characters like é and ñ correctly.
The explanation · step 2 of 4 · part 5 of 5
The whole page (continued)
- The
<title>shows on the browser tab. The<link>joins the page to its stylesheet. - The body holds everything you see on the page.
Indenting means adding spaces at the start of a line. It shows which tags sit inside which. The browser ignores it, but people need it.
Keep index.html, style.css and the image in the same folder. Otherwise the browser cannot find them.
The explanation · step 3 of 4 · part 1 of 4
The stylesheet
This is style.css. It sits in the same folder as index.html.
The explanation · step 3 of 4 · part 2 of 4
The stylesheet (continued)
body {
font-family: Arial, sans-serif;
background-color: #FDF6E3;
color: #222222;
}
h1 {
color: #1A5276;
text-align: center;
}
img {
width: 300px;
}The explanation · step 3 of 4 · part 3 of 4
The stylesheet (continued)
- The
bodyrule sets the font, the background colour and the text colour for the whole page. - The
h1rule makes the main heading dark blue and puts it in the middle. - The
imgrule makes the image 300 pixels wide.
CSS uses American spelling: color, not colour. The browser ignores a rule it cannot read, and shows no error.
The explanation · step 3 of 4 · part 4 of 4
The stylesheet (continued)
Why put the style in a separate file?
One stylesheet can style many pages. Change one rule and every page changes.
The explanation · 1 more step
More on the lesson page
The lesson page has the rest of the explanation, step by step:
- Validate: check every tag
Year 8 · Building the Web · Lesson 5 of 5
Worked example
Find and fix the errors. Line 1: <h1>Tetris<h1>. Line 2: <p>A puzzle game from <strong>1984</p></strong>. Line 3: <img src="tetris.png">.
- Line 1: the second tag has no slash. Change it to
</h1>. - Line 2: the tags close in the wrong order. Close
</strong>first, then</p>. - Line 3: the image has no alt text. Add
alt="Coloured blocks falling into a stack". - Line 3 needs no closing tag.
<img>is an empty element. - Save, refresh the browser, and run the validator again.
Year 8 · Building the Web · Lesson 5 of 5
Quick quiz · 1 of 3
In <img src="cat.png" alt="A sleeping cat">, alt is…
- A A tag
- B An attribute
- C A CSS property
B. An attribute
Attributes sit inside the opening tag as name="value". alt describes the image for screen readers.
Year 8 · Building the Web · Lesson 5 of 5
Quick quiz · 2 of 3
A box has width 100px, padding 10px, border 2px, margin 5px. How wide is it on screen, from border edge to border edge?
- A 124px
- B 134px
- C 112px
A. 124px
Content + padding on both sides + border on both sides: 100 + 20 + 4 = 124px. Margin is outside the border.
Year 8 · Building the Web · Lesson 5 of 5
Quick quiz · 3 of 3
The padlock in the address bar tells you…
- A The site is honest
- B The site has no viruses
- C The connection is encrypted with HTTPS
C. The connection is encrypted with HTTPS
It proves the domain and encrypts the traffic. It says nothing about honesty.
Year 8 · Building the Web · Lesson 5 of 5
Exit ticket
Answer on paper before you go. Then check.
When you search, a search engine looks in…
A Your browser historyB Its index, built earlier by crawlersC The live web, right then
B. Its index, built earlier by crawlers Crawl → index happen in advance. Searching just looks words up in the index, then ranks the matches.
In https://www.bbc.co.uk/news, the path is…
A www.bbc.co.ukB /newsC https://
B. /news The path comes after the domain. It says which page on that server.
Year 8 · Building the Web · Lesson 5 of 5
Homework and the challenge
Homework
Study page 16 to the quiz.
End-of-unit challenge
Build a page to a written spec, then explain in three steps how a search engine would find it.