Cheat sheet
Help
Everything you need for your hobby page, in one place.
CSS
A CSS rule picks some elements, then changes how they look:
selector { property: value; } Put your rules inside <style> in the head. The selector can be any tag name: body, h1, p, li, a.
| Property | Changes | Example |
|---|---|---|
color | Text colour | h1 { color: navy; } |
background-color | Background colour | body { background-color: lightyellow; } |
font-family | The font | p { font-family: Arial, sans-serif; } |
font-size | How big the text is | p { font-size: 18px; } |
text-align | Left, right or center | h1 { text-align: center; } |
Colours can be names like navy, tomato or lightyellow, or codes like #F2B533.
Common mistakes
- Writing colour or centre
- CSS uses American spelling: color, background-color, center.
- Mixing up title and h1
- The title shows on the tab. The h1 shows on the page.
- Putting headings inside head
- head holds information about the page. Put visible content in body.
- An li on its own
- Every li needs to sit inside a ul or ol.
- A link without https://
- Web addresses need https:// at the start.
- Link text that says “click here”
- Say where the link goes, e.g. “Visit the FA website”.
- alt="image" or no alt
- Describe the picture for someone who can’t see it.
- More than one h1
- A page has one h1, like a book has one title.
- Jumping from h2 to h4
- Go down one level at a time.
- Forgetting ; between CSS lines
- Each property: value; pair ends with a semicolon.
- Writing </img>
- img has no closing tag.
Using the keyboard
- In the code editor, Tab indents your code.
- Press Esc to leave the editor and move to Check my page.
- Ctrl + Z undoes your last change.
Your work is saved in this browser only. Nothing you type is sent anywhere.