HTML
Intermediate
40 mins
Teacher/Student led
+125 XP
Pupils work on their own device

Styling with CSS

Learn how to change the appearance of your web page using CSS. Adjust colours, fonts and spacing with block controls and then by typing code yourself. See that the content remains unchanged while the style transforms completely.

Teacher Class Feed

Load previous activity

    1 - Start: What We're Building ~3 mins

    Illustration for Start: what we're buildingYour site says the right things. Today you decide how it looks: its colours, its font, the size of its text.

    And today is the day you stop only reading the code and start writing it.

    Getting started

    Open the builder below and carry on with your site.

    2 - Content and Style ~4 mins

    Everything you have written so far says what things are: a heading, a paragraph, a picture. None of it says what they should look like. That is a separate job, and it has its own language: CSS.

    A CSS rule has three parts worth naming, because you will use these words all lesson:

    Key point
    • the selector, which says what the rule is about. Below, that is body, which means the whole page.
    • a property, the thing being changed, like background or color.
    • a value, what it is being changed to, like lightblue. Every line ends in a semicolon.
    One CSS rule taken apart: body is the selector, what the rule is about; background is the property, the thing being changed; lightblue is the value, what it is changed to; the semicolon ends every line.

    So this rule says: for the whole page, make the background pale blue.

    body {
      background: lightblue;
      color: navy;
      font-family: sans-serif;
    }

    3 - Find Your Page in the CSS ~4 mins

    Before you change anything, find your page in the CSS.

    1. In the builder below, click the CSS tab.
    2. The very first rule, at the top, is your page. Everything below it styles buttons, pictures and lists; you did not write those and you can ignore them today.

    Right now that top rule looks exactly like this, because nobody has changed anything yet:

    body {
      background: white;
      color: black;
      font-family: sans-serif;
      margin: 16px;
    }

    Web Page Builder

    4 - Change a Colour and Watch That Rule Change ~5 mins

    Now change it, keeping one eye on that top rule.

    1. Click the Blocks tab. On the blue page block, find the dropdown labelled background and pick a different colour.
    2. Click back to the CSS tab. In that same top rule, the background line now holds the colour you picked.
    3. Do the same with the text dropdown, then font. Each one changes its own line in that one rule.
    Before you go on

    Point at the top rule and say which property you changed: background, color, or font-family.

    This is the block those three dropdowns live on:

    {"blocks": {"languageVersion": 0, "blocks": [{"type": "web_page", "fields": {"NAME": "Home", "BG": "white", "FG": "black", "FONT": "sans-serif"}, "inputs": {"CONTENT": {"block": {"type": "wp_heading", "fields": {"TEXT": "My page", "ALIGN": "left"}}}}, "x": 10, "y": 10}]}}

    Web Page Builder

    123learn · Online learning platform

    Unlock the full learning experience

    You're previewing this lesson. Get full access to this lesson and hundreds more — each one ready to teach, with interactive activities, printable resources and pupil progress tracking built in.

    Hundreds of curriculum-aligned lessons
    Interactive activities in every lesson
    Printable resources & progress tracking
    Copyright Notice
    This lesson is copyright of Coding Ireland 2017 - 2026. Unauthorised use, copying or distribution is not allowed.
    🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more