Grouping

When creating the style for the site and many selectors are used simultaneously, iterative parameters may appear. In order not to group one and the same elements twice, they can be integrated.

Example 14.1. Style for each selector.

H1 { 
  font-family: Arial, Helvetica, sans-serif; 
  font-size: 160%; 
  color: #003; 
}
H2 { 
  font-family: Arial, Helvetica, sans-serif; 
  font-size: 135%; 
  color: #333; 
}
H3 { 
  font-family: Arial, Helvetica, sans-serif; 
  font-size: 120%; 
  color: #900;
} 
P {
  font-family: Times, serif;
}

We see that the style for title tags contains the same parameter font-family. And integration allows defining one parameter for several elements, as it is shown in the example 14.2.

Example 14.2. Integrated selectors

H1, H2, H3 { 
  font-family: Arial, Helvetica, sans-serif; 
} 
H1 { 
  font-size: 160%; 
  color: #003;
}
H2 { 
  font-size: 135%; 
  color: #333;
}
H3 { 
  font-size: 120%; 
  color: #900;
}

Selectors are integrated as a list of tags, which are separated from each other by commas. Not only selectors of tags can be in the group, but also identifiers and classes. Syntax:

Selector  1, Selector  2, ... Selector  N { Description of the style rules }

So, the style rights are applied to all selectors, which are listed in one group.