
The CSS Rule
How to Enchant Your Elements with Style
Selectors and declarations are the spells that breathe new life into your webpage’s elements. Every spell begins with a selector, followed by a declaration block. Don’t worry — it sounds more complicated than it is. The block contains property-value pairs that define how your element looks. And it doesn’t stop at one transformation. Add a few more, and your element will look like a wizard with style — from its color to its border.
Ah, and don’t forget the semicolon — that small, unassuming detail. Leave it out, and the next spell gets stuck, rendering your magic ineffective. With that said, let’s delve into the mysteries of CSS rules and ensure your spells work perfectly — and look amazing in the process!
The Anatomy of a CSS Rule
Some magical terms you should master
Always these foreign words
The who’s who of technical terms
- Selector: The magical pointer.
- Declaration { … }: The spell itself.
- Property: What you want to change.
- Colon (:): The invisible magician connecting property and value.
- Value: How it should look.
- Semicolon (;): The final wand flourish to complete the spell.
Example:
Selector { property : value ; }

Selector
The Magical Pointer
The selector is your wand, determining which elements on your webpage feel the power of CSS. With a precise gesture, you point to what you want to transform—whether it’s a proud heading, a humble paragraph, or an image in need of a touch-up. The selector is the key to unleashing your magical styles on the right elements.
h1, .classname, ...

Declaration
The Spell of Styling
The declaration is the core, the actual spell that reshapes the appearance of your elements. It consists of a property and a value, which together define the shape and appearance. Here, you change colors, sizes, and styles. The semicolon at the end acts as the final wand flourish—without it, the magic fizzles out, leaving your spell ineffective.
h1 {
}

Property-Value Pair
The Secret Formula
Every declaration has its secret formula: the property-value pair, the true source of magic. The property defines what you want to change, and the value determines how it should look—be it a shimmering color or a new shape. The colon in between is the invisible magician, connecting the two and making the magic possible.
h1 {
font-family: Georgia, serif;
}