CSS Lab - Example page

In CSS there are Rules and Style Sheets. A rule is a statement about one stylistic aspect of one or more elements. A style sheet is one or more rules that apply to an HTML document.

Example of a Rule

h1 { color: red }

A Rule rules consists of two parts: Selector - that part before the left curly brace, and Declaration - that part within the curly braces

h1 { color:red }

A declaration has two parts separated by a colon: Property - that part before the colon Value - that part after the colon

h1 { color:red }

Grouping Selectors

Group the selectors into a comma-separated list and only write the declaration

Grouping Declarations

Group the declarations that relate to the same selector into a semicolon-separated list