Producing web pages
* HTML CSS DHTML XHTML A to Z of tags        Accessibility          Design

Grouping styles

Quite often, tags share some of the same styles, for example, they might use the same font:

h1 {font-size: 15pt;
    font-weight: bold;
    color: blue};
h2 {font-size: 15pt;
    font-weight: bold;
    color: blue};
h3 {font-size: 15pt;
    font-weight: bold;
    color: blue};

In these cases, don't define the font for each and every tag, one by one. Group them instead and assign the font to all the tags at once. For example, if heading levels 1 to 3 share the same font-face and colour, you can group them as follows:

h1, h2, h3 {font-size: 15pt;
            font-weight: bold;
            color: blue;}

You can also group formatting specifications. For example:

h1 {font-size: 15pt;
    line-height: 17pt;
    font-weight: bold;
    font-family: "Arial";
    font-style: normal;}

Use this instead:

h1 {font: 15pt/17pt bold "Arial" normal;}