HTML and CSS lesson 10: Your first CSS rules
UK version. UK school years and UK spelling. · US version of this lesson
CSS changes how a page looks. A rule is a selector, then { property: value; } – for example p { color: blue; } makes every paragraph blue. A complete 40-minute HTML and CSS lesson for beginners (Year 7, KS3), from Unit 4: CSS: style rules. You build real web pages right here in your browser – nothing to install.
- Time
- 40 minutes + 20 min homework
- Year
- Year 7, KS3 (ages 11–12)
- You need
- A computer or tablet, paper and a pencil
- Marked
- Instantly, with explanations
For parents: how to use this lesson
You don't need to know HTML yourself. The lesson explains each step on screen, the way Mr Babbage, our Head of Computing, likes it: a worked example first, then a go for your child. When your child builds a page, the browser draws it straight away and Classfern marks it with a checklist.
- Read what your child will learn together.
- Press Start the lesson below. Sit with your child for the teaching and the worked example (about 15 minutes): ask them to point at each tag and say what it does.
- Let them do the practice on their own. If a page doesn't look right, the checklist says what is missing – let them find the mistake before you help.
- Finish with the exit questions and the talk question: “Why might a browser ignore CSS mistakes instead of stopping the page?”
- Later that day or the next day: the homework (20 minutes), then a practice test.
Watch out for
colourworks on UK websites. CSS is the same everywhere:color.- A CSS mistake shows an error message. The browser silently skips it.
Miss Lovelace's tip for home: ask your child to change one thing on their page – a word, a colour, a size – and predict what will happen before they look. Predicting first is how programmers learn fastest.
What your child will learn
We are learning to write a CSS rule in a <style> tag.
Success looks like
- I can write a CSS rule in a
<style>tag. - I can name the selector, property and value.
- I can find and fix a CSS spelling or punctuation mistake.
Key words
CSS · rule · selector · property · value · declaration · style tag
What to have ready
- A device with a web browser (pages are built and checked right in the browser – nothing to install)
- Paper for planning and sketching
- A keyboard helps for typing code (a tablet works too)
The big ideas (for the adult)
HTML says what things ARE; CSS (Cascading Style Sheets) says how they LOOK. CSS rules go inside a <style> tag in the <head>.
A rule has a selector, which picks the elements (p means every paragraph), then curly brackets holding declarations: a property, a colon, a value and a semicolon – color: blue;. When two rules set the same thing and are equally specific, the later one wins.
The big trap: CSS always uses American spelling. colour: red; and text-align: centre; are silently IGNORED – no error, nothing happens. A missing colon or semicolon is ignored the same way, so when a change doesn't show up, read your rule letter by letter.
Worked example: two rules
CSS:
h1 { color: navy; }
p { color: green; }HTML:
<h1>Hello</h1> <p>Some text.</p>
The lesson, step by step
| Part | Time | How it is checked |
|---|---|---|
| Starter | 5 min | Marked by Classfern |
| Learn | 8 min | Read, watch and talk |
| See it | 7 min | Marked by Classfern |
| Practise | 15 min | Marked by Classfern |
| Check and reflect | 5 min | Marked by Classfern + self-check |
The lesson
It runs here on the page. No sign-up and no names – nothing you type is sent anywhere. Each visit picks a new mix of questions.
Homework
20 minutes: predict what the browser will do, build or fix a short page, and check the key ideas – then a short reflection. New questions every time, all marked instantly.
Practice tests
- CSS rules, selectors and colour test12 questions · marked instantly
- Mixed HTML and CSS test20 questions · marked instantly
- Mixed HTML and CSS test20 questions · marked instantly
All KS3 computing practice tests · All 20 HTML and CSS lessons
Curriculum
National curriculum in England, computing, key stage 3: pupils should be taught to use 2 or more programming languages, at least one of which is textual, to solve a variety of computational problems; make appropriate use of data structures [for example, lists, tables or arrays]; design and develop modular programs that use procedures or functions.
Contains public sector information licensed under the Open Government Licence v3.0.
Our lessons and questions are our own. They are not written or endorsed by any government department, testing agency or exam board. HTML and CSS are open web standards; Classfern is not affiliated with the organisations that publish them.