Written by:Md Sirajul Islam
7th February 2010
Under Category : css class complete tutorial
Importance of CSS class
Say,In your website there is 100 pages and in each page you have set a certain element such as text box or image . If you set styling individualy in each page element , afterwards when you decide to change the style of this page element what will you do ? You have to go through in each page coding to change it . If the number of pages is larger and so is the number of element,then the coding change task will be so much pain full .But if you set a single css class and apply it to any number of page elements in any number of webpage , when you decide to change or restyle , all you have to do go through a single css class.Then the effect will be applied to all page elements related to the class .
I think an example will clear the fact-
Example to show the importance of css class
css class code , watch the results below
Result or demonastration of the above html code
element1
element1
element1
but same class
element1
element1
but same class
element2
element2
element2
but same class
element2
element2
but same class
element3
element3
same class
element3
same class
element4
element4
same class
element4
same class
Download the source files
Download two source file from this linkDocumentation or Usage
To view the effect,open this introduction to css.html with word pad(select the file,right click,then select open with word pad) . In my class change the .9em to any number like .8em or .6em , see the effect.,or you can change the background colour to #F781BE or any color you choose. or change the width valu from 80 px to any value like 60px