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 the techniques of design. You will learn them and use them.
Key words
| Word | What it means | Example |
|---|---|---|
| Layout grid | Invisible rows and columns that line up everything on a page. | |
| White space | Empty space around and between things. It is not wasted. | |
| Typeface | The design of the letters. Also called a font. | Arial, Georgia |
| Letter spacing | The space between letters. | |
| Line spacing | The space between lines of text. | |
| Justification | How text lines up at the sides: left, right, centre or both sides. | |
| Contrast | How different two colours are, such as text and background. | |
| Contrast ratio | A number from a checking tool. A higher number is easier to read. | 4.5 to 1 |
| Input focus | The control that will get the next key press. | |
| Hover | When 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
| Technique | What it does | CSS |
|---|---|---|
| Layout grid | Lines things up in columns | display: grid |
| Space | Room around things | padding, margin, gap |
| Font choice | Sets the typeface | font-family |
| Letter spacing | Space between letters | letter-spacing |
| Line spacing | Space between lines | line-height |
| Justification | Lines text up | text-align |
| Colour and contrast | Text and background colours | color, background |
| Focus and hover | Show which control is active | :focus, :hover |
The cells students fill in are left blank in this preview.
Try it: a layout grid
<div class="grid">
<div>One</div><div>Two</div><div>Three</div>
<div>Four</div><div>Five</div><div>Six</div>
</div>
Quick check: grids and space
Have a go
Quick check: grids and space
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.
Type: choose and set it
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.
Try it: set the type
<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>
Colour and 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.
The rule: 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 background | Ratio | Good enough for body text? |
|---|---|---|
| Black on white | 21 to 1 | Yes |
| Dark grey (#767676) on white | About 4.5 to 1 | Yes, only just |
| Light grey (#aaaaaa) on white | About 2.3 to 1 | No |
The cells students fill in are left blank in this preview.