A CSS document (a
style sheet) consists of a set of
style rules
A CSS document (a
style sheet) consists of a set of
style rules. Each
style rule starts with a selector and is followed by
a
declaration block enclosed by curly braces. The selector
defines a pattern, and the declarations are applied to the objects
that match the pattern.
The basic example below shows how to apply the color
red to all emphasis elements in the HTML document.
em { color : red ; }
where em
is the selector,
and “color : red ;
” is a
declaration.
It is possible to group several rules with the same declarations.
Use a comma “,” to separate the selectors. For example:
em, b { color : red ; }