Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

OS 6.2 (2 of 3): User interface techniques

The whole lesson, free. Read it and have a go at the activities. To work the tasks and labs in the real lesson, press Start lab, with no account needed.

50 minutes

A quick check that you are not a bot, then your own lab opens on the interactive lesson.

Already have an account? Sign in

Same words, two pages

Imagine two pages with the same words. One has tiny grey text on a light grey page, with no space between the parts. The other has clear black text, space around each part and a bold heading.

Which one do you read? Which one do you leave?

The difference is not the words. It is design technique. This lesson shows you how to use it.

Key words

WordWhat it meansExample
Layout gridInvisible rows and columns that line up everything on a page.
White spaceEmpty space around and between things.
TypefaceThe design of the letters. Also called a font.Arial, Georgia
Letter spacingThe space between letters.
Line spacingThe space between lines of text.
JustificationHow text lines up at the sides.
ContrastHow different two colours are.
Contrast ratioA number that measures contrast. Higher is easier to read.4.5 to 1
Input focusThe control that will get the next key press.
HoverWhen the mouse pointer rests on a control.

The cells students fill in are left blank in this preview.

Techniques and the CSS that does them

TechniqueWhat it doesCSS
Layout gridLines things up in columnsdisplay: grid
SpaceRoom around thingspadding, margin, gap
Font choiceSets the typefacefont-family
Letter spacingSpace between lettersletter-spacing
Line spacingSpace between linesline-height
JustificationLines text uptext-align
Colour and contrastText and background colourscolor, background
Focus and hoverShow which control is active:focus, :hover

The cells students fill in are left blank in this preview.

A grid lines things up in columns

Code: web
<div class="grid">
  <div>One</div><div>Two</div><div>Three</div>
  <div>Four</div><div>Five</div><div>Six</div>
</div>

Make a free account to save your work and track your progress.

Check: grids and space

Have a go

Check: grids and space

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Clear type is easier to read

Choose a clear typeface. Use at most two on a page. Set body text at 16 pixels or bigger. A pixel is one tiny dot on the screen.

Give lines room: line spacing of about 1.5 times the text size helps reading. For text of 16 pixels, that is 24 pixels from one line to the next. Add a little letter spacing to small capital letters.

For justification, left aligned text is the easiest to read. Text spread to both sides makes uneven gaps.

Line spacing and alignment change reading

Code: web
<h2>Match day</h2>
<p>The team meets at nine at the bus stop. Bring your kit, a water bottle and your student card. The bus leaves at ten. We play at twelve and we are back by four.</p>

Make a free account to save your work and track your progress.

Text needs enough contrast

Text must be easy to see on its background. A free contrast checker gives you a number, the contrast ratio. You do not work it out. You read it.

Body text needs a ratio of 4.5 to 1 or more. Large text needs 3 to 1 or more. Do not use colour alone to give a message. Some people cannot tell red from green.

Contrast ratios from a checker

Text and backgroundRatioGood enough for body text?
Black on white21 to 1Yes
Dark grey (#767676) on whiteAbout 4.5 to 1Yes, only just
Light grey (#aaaaaa) on whiteAbout 2.3 to 1No

The cells students fill in are left blank in this preview.

Check: can you read it?

Have a go

Check: can you read it?

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Hover and focus show the active control

Code: web
<button class="go">Book a place</button>
<input placeholder="Press Tab to come here">

Make a free account to save your work and track your progress.

Match each technique to its meaning

Have a go

Loading…

Your answers are marked here and are not kept. A college account keeps every student’s marks.

Fix a page that is hard to read

This open day page is hard to read. Fix the CSS. Follow the five TODO notes in the CSS. Make the cards a grid with a gap and padding. Use a clear font, a bigger body size and a line-height of about 1.5. Make all text dark enough. The contrast ratio must be 4.5 to 1 or more. Give the button a hover colour and a visible focus outline. Your teacher marks this task. Check your colours with a free contrast checker.

Code: web
<div class="page">
  <h1>College open day</h1>
  <p class="intro">Come and see our computing labs. Meet the teachers. Try a coding class. Free lunch for every visitor. Saturday 14 November, from 10 in the morning.</p>
  <div class="cards">
    <div class="card"><h2>Computing</h2><p>Learn to code in Python and build websites.</p></div>
    <div class="card"><h2>Art</h2><p>Paint, draw and make films.</p></div>
    <div class="card"><h2>Sport</h2><p>Football, swimming and a new gym.</p></div>
  </div>
  <a href="#" class="button">Book a place</a>
</div>

Make a free account to save your work, or press Start lab to work through the whole lesson.

Key words crossword

Have a go

Loading…

Your answers are marked here and are not kept. A college account keeps every student’s marks.

Exit quiz

Have a go

Exit quiz

5 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Teach this lesson with your class

On a college account your students work the tasks and the labs as well, and every mark is kept for you.