Professional Business Website · Project

Professional Business Website · Phase 3 · Lesson 1 of 3

CSS Basics: Brand Colours, Fonts and Spacing

Link one stylesheet to every page and build a small brand system of colours, fonts and spacing with CSS custom properties, checking colour contrast as you go.

What you need

A computer (Windows, macOS or Linux) with Visual Studio Code (free) and a current web browser such as Chrome or Firefox. A smartphone is used for testing.

In this lesson you will

  • Apply a consistent brand style with custom properties
  • Check text contrast for readability

Key concepts

stylesheetselectorcustom propertysystem fontscontrast ratiospacing scale

The lesson

Link one file, css/styles.css, from every page. Define brand values once as custom properties, such as --brand: #1d448a, and reuse them, so a colour change takes one edit.

System fonts (the fonts already on the device) load instantly and cost no data. Use them unless the client's brand truly needs a web font.

Text must contrast strongly with its background for readability in bright sunlight and for people with low vision. Use a contrast checker and keep body text at least 16 pixels.

Step by step

  1. Create css/styles.css and link it from all five pages.
  2. Define colour, font and spacing custom properties in :root.
  3. Style the body text, headings, links and buttons.
  4. Check contrast of text and buttons and adjust colours that fail.

Practice activity

Build the base stylesheet with custom properties and style typography, links and buttons consistently on every page.

Expected result: A consistent style across all pages, defined in one stylesheet, with readable contrast.

Common mistakes

  • Writing the same colour code dozens of times instead of using a custom property
  • Pale grey text on white that is unreadable in sunlight

Check your understanding

  1. Why define colours as custom properties?

    Show answer

    So each colour is defined once and can be changed in one place.

  2. Why prefer system fonts on this project?

    Show answer

    They are already on the device, so they load instantly and use no data.

Further learning

Projects are instructor-guided: an instructor sets milestones, checks your work and gives feedback, online or in person. Self-study of the public lessons does not lead to a certificate. Enrolment and fees follow the Academy's existing policies — contact the Academy.