CSS Tutorial – 04 – Grouping

To keep our style sheets short and easy to
edit we can group similar rules together. First, if we want a style to apply to several
selectors we just need to separate them with a comma.
Second, if we want to apply more than one style at a time, we can separate each declaration
with a semicolon (;). The last semicolon is not necessary but it’s a good practice to
include it. These two can also be combined to group both
selectors and declarations. This gives us several ways of doing the same
thing. For example, if we want to color the text
and the background of two headers we can either write each rule separately.
or we can group them by selectors, declarations, or both at the same time.

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *