CSS TUTORIAL
CSS Class
In the previous example we saw, how we could use CSS ID to use different styles on one or other element. Class is another concept used in styling and it is important that you understand it.
The CSS class selector is specifies style for a group of elements. The class selector is often used on several elements.Using class you can use the same style for many HTML elements. The class selector is defined with starting with a "." Let us understand it with an example.
<html> <head> <style type="text/css"> .blue { color:blue; } </style> </head> <body> <h1 class="blue">Center-aligned heading</h1> <p class="blue">Center-aligned paragraph.</p> </body> </html> |
You may like to try this code using online tool here
Explanation

Before you proceed further, you may like to experiment a bit on class. As an exercise, try to create two classes. The first class will align it in center and make it in red color. The second class will align it left and will have blue color.
Use the two class on two sets of header and paragraph.
It is time to take a coffe break. We promise to take up something very simple in the next post in the series of this tutorial - the comments in css.