Grouping

You will notice that after a while you are writing the same styles for different elements or want to use different styles for one element (or a group of elements for that part). Hence the practice of "grouping".

You can group selectors, declarations or everything. Let's say you want all your heading levels to have the same color. Instead of making a rule for each heading separate, you can group them like this:

H1, H2, H3, H4, H5, H6 {color: blue;}

Or maybe you want your paragraphs and just your heading level 4 to be blue? No problem:

H4, P {color: blue;}

Okay, but i want my H1 to have blue text, Arial font, font-size of 18 pixels and with a red background. Now what? Do i have to write three times those rules with H1? Of course not. You'll group your declarations like this:

H1 { font : 18px Arial; color: blue; background: red;}

Okay, now you know how to group selectors and declarations. Let's mix all this into one single method of grouping. Let's just group everything.

I want all of my headings to have a blue color with a red background and Arial font with a font-size of 18 points. Well, no problem:

H1, H2, H3, H4, H5, H6 {font : 18pt Arial; color: blue; background: red;} 

Or maybe your paragraphs and just your headings with level 4 and 6 need these styles? Here you go:

H4, H6, P {font : 18pt Arial; color: blue; background: red;}

Some more scribbles for you to look at.

More Pages

Links to other parts of the site.

Friends

People who have been good enough to me that I would call them friends.

You can get your W3C stuff at the W3C site

The W3C Logo

It's has all the specifications you need, some tutorials and also validation tools. If you get into CSS you'll be needing this link !

Unless otherwise expressly stated, all original material of whatever nature created by Dzinelabs and included in this site and any related pages, including the weblog's archives, is licensed under The Creative Commons License.

The Creative Commons Licence logo