Skip to content

04. CSS Rules

martin@mustbebuilt.co.uk edited this page Sep 3, 2024 · 2 revisions

CSS is based on rules. A rule declaration is broken down as follows:

CSS Rule

The selector can be an HTML element such as <h1> above. This is known as an HTML selector. The curly brackets enclose a ‘property/value’ pair. More than one ‘property/value’ pair can be added. These are separated by semi-colons and usually, for ease of editing placed, on a new line. For example:

h1 {
    font-size: 16px;
    color: #000099;
    font-family: Arial, Helvetica, sans-serif;
}

There is a number of ways in which selectors can be declared. The above is an HTML selector. There are also a large number of properties. These 20 properties provide a good starting point.

Clone this wiki locally