▶ TrainingGet Pro
All tools & lessonsAll toolsAllGet the appApp
Learning departments Music, Math, Cookery, Programming and Art are open – explore →

HTML and CSS lesson 13: Styling text: size, weight and alignment

US version. US grades and US spelling. · UK version of this lesson

font-size, font-weight, font-style, font-family and text-align style text. Sizes need units (px, em), and some properties are inherited. A complete 40-minute HTML and CSS lesson for beginners (Grades 6–7), 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
Grade
Grades 6–7 (ages 11–12)
You need
A computer or tablet, paper and a pencil
Graded
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 grades it with a checklist.

  1. Read what your child will learn together.
  2. 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.
  3. 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.
  4. Finish with the exit questions and the talk question: “Which text styles make a page easier to read, and which make it harder?”
  5. Later that day or the next day: the homework (20 minutes), then a practice test.

Watch out for

  • font-size: 20 works. Lengths need a unit: 20px.
  • text-align: centre works in the UK. CSS only knows center.

Miss Lovelace's tip for home: ask your child to change one thing on their page – a word, a color, a size – and predict what will happen before they look. Predicting first is how programmers learn fastest.

What your child will learn

Learning goal: change the size, weight and style of text.

Success looks like

  • I can change the size, weight and style of text.
  • I can line text up with text-align.
  • I can explain inheritance and em units.

Key words

font-size · unit · px · em · font-weight · text-align · inheritance

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)

font-size: 24px; sets the size – and it MUST have a unit (font-size: 24 is ignored). em means "times the text size around it": in 20px text, 2em is 40px. font-weight goes from 100 (thin) to 900, where bold is 700. font-style: italic; makes italics.

text-align: center; centers text – the American spelling again; centre is ignored. font-family picks a font, with a back-up: font-family: Arial, sans-serif;.

Some properties are inherited: if a <div> is centered or blue, the text inside it is too, unless a rule changes it. color, font-size and text-align are inherited; borders and backgrounds are not.

Worked example: text styles

CSS:

h1 { text-align: center; font-size: 40px; }
.note { font-style: italic; font-weight: bold; }

HTML:

<h1>Big news</h1>
<p class="note">Read this carefully.</p>

The lesson, step by step

40 minutes in 5 parts
PartTimeHow it is checked
Starter5 minGraded by Classfern
Learn8 minRead, watch and talk
See it7 minGraded by Classfern
Practice15 minGraded by Classfern
Check and reflect5 minGraded 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 graded instantly.

Practice tests

All computer science practice tests · All 20 HTML and CSS lessons

Curriculum

CSTA K–12 Computer Science Standards (2017), grades 6–8: 2-AP-17 – Systematically test and refine programs using a range of test cases.

The standard codes are CSTA's; the descriptions are our own words.

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.