CSS TRAINING · LESSON 1 OF 4 · 3 MIN READ

Read a CSS rule

Connect a selector to the elements it should style.

Understand the idea

A CSS rule combines a selector with declarations inside braces. The selector identifies which elements should be styled. A declaration pairs a property with a value, separated by a colon. A class selector starts with a dot, such as .card for elements with the card class.

Work through it

Choose the intended element or class first. Add a property and value inside braces, then separate declarations with semicolons. Check spelling carefully: an unrecognised property or the wrong selector can prevent a style from applying. The practice exercise specifically asks for one .card rule.

SEE IT IN CONTEXT

Worked example

.card {
  padding: 16px;
}

The selector targets a class named card. The declaration adds inner space. This is a teaching example; the full exercise asks for three specific properties and values.

Common mistakes to avoid

  • Forgetting the dot before a class name.
  • Mixing up colons and semicolons.
  • Writing declarations outside the braces.

NOW HAVE A GO

Style a clean event card

Apply the idea in the linked activity. Follow its own brief and values; examples in this lesson are illustrative.

Try the practice activity →Download the practice starter
About the linked activity

The linked CSS exercise checks exactly three declarations in one .card rule. These four lessons build toward that same activity. The checker does not apply your code to the website or implement all CSS behaviour.

Reading marks are self-reported and saved only in this browser.

0 of 4 lessons marked as read

Keep learning: Reference documentation ↗

YOUR LEARNING JOURNEY

Look how far you’ve come.

Your progress is saved in this browser. Clearing browser data removes it.

Manage saved progress

This removes your completed-challenge history from this browser.