Skip to content

CSS Course

HTML gives a page structure and meaning. CSS controls how that structure looks: colour, type, spacing, and layout.

This track follows the HTML course. You will use the same index.html file and add a separate stylesheet.

Start with What is CSS?

Before you start

You should be able to build a simple HTML page with headings, paragraphs, links, and images. If not, work through the HTML course first.

You need a folder containing an HTML file and a CSS file. Keep them in the same folder so the path is easy to manage.

Linking a stylesheet

Add this line inside <head>:

<link rel="stylesheet" href="styles.css">

The href must match the CSS file name exactly. If the file is in a folder, include the folder in the path:

<link rel="stylesheet" href="css/styles.css">

If the styles do not appear, check the file name and path first. That is the most common mistake.

How to use this track

  • Type the examples instead of copying them.
  • Change one value at a time and reload the browser.
  • Use the browser's developer tools to inspect the element and see which CSS rules apply.
  • Keep a small project open while you read. The practice chapters make more sense when you have a page to style.

Chapters

The chapter numbers are the recommended order. The groups below match that order.

Foundations

  • What is CSS?: rules, declarations, and where to put CSS.
  • Box Model: content, padding, border, margin, and box-sizing.
  • Selectors: type, class, id, attribute, and combinators.
  • Nesting: write related selectors inside one rule.

How CSS is applied

Values and colour

  • Color: hex, rgb, hsl, and currentColor.
  • Sizing: px, rem, em, percentages, and viewport units.

Layout

Reusable values and spacing

Appearance

Typography and responsive design

Finishing

What you should be able to do at the end

  • Link a stylesheet and explain why a rule is not applying.
  • Use classes and a small set of reusable values.
  • Build a page layout with flexbox or grid.
  • Make text readable and colour contrast accessible.
  • Adjust a page for narrow screens without duplicating all your CSS.

CSS describes presentation. HTML still describes meaning. Keep that split and both languages stay simpler.