To keep style sheets short and easy to edit, similar rules can be grouped together. This grouping provides several ways to specify a set of related rules. For example, you can color the text red and the background black for two header elements in four different ways, as described in the following sections.
Ungrouped Rules
Grouped Selectors
Grouped Declarations
Grouped Selectors and Declarations
Rules should be grouped whenever possible to make the style sheet more succinct. This has a small performance benefit because concise rules reduce the size of the style sheet, which makes the CSS file load more quickly. Moreover, it is convenient to specify the properties in only one place, in case they have to be changed later. Additionally, grouping selectors with similar styles makes it easier to maintain consistency between them.