LESSON 01 OF 100

Your first CSS rule

Write a complete CSS rule for a paragraph.

Official sourceW3C CSS Syntax — style rulesReviewed: 2026-08-26
STEP 1 · LEARN

How it works

A style rule has a selector followed by a block in braces. Inside it, each declaration has a property, a colon and a value.

Correct example
p { color: #1d4ed8; }

The p selector chooses paragraphs, while the color property sets the text colour.

Common mistake
p { color #1d4ed8 }

Without the colon, the sequence is not a valid declaration and is ignored.

STEP 2 · APPLY

Your exercise

Complete the rule so the paragraph uses #1d4ed8.

STEP 3 · BUILD

Write and see the result

index.htmlCSS
Safe resultisolated
The draft stays only in this browser.HTML and CSS allowed · scripts and network blocked
STEP 4 · CHECK

What needs to pass

0%not checked
  • The p rule sets color to #1d4ed8.
  • The page keeps a visible paragraph.
Explain the solution logic

The selector identifies the target; the valid declaration changes one property on that target.