For this goal i have tried to know what is cascading style  sheet and how to write them.

Cascading Style Sheet
                                        Suppose you will have a font in a page  about 500 or 1000 times what happens if you want to change them you have to be change every place now imagine if you also have to change some styles and color of pages how hactic it is .To avoid these things Cascading Style Sheets are used .
        Basically, CSS is used to set customized preferences for HTML tags. You can change colors, positioning, font, and many other options with CSS. However, you are limited to customization within the spectrum that normal HTML can handle. In other words, CSS is another way of writing HTML preferences or subsections.
 

    To learn how to write Cascading Style Sheets i found a good tutorial at www.javascript-page.com.
        I have write  a simple cascading style sheet which will change the background color of the page. This is a good example of Cascading Style Sheets and CGI scripts .when you fill some color CGI script will process it and put the value in the cascading style sheet file so that when you reload the page color will be changed
 

    The script is as follows:

 #!/usr/bin/perl

#program to take the value from form
if($ENV{'REQUEST_METHOD'} eq "POST")
 {
  read(STDIN,$var,$ENV{'CONTENT_LENGTH'});
 }
 
@var=split(/&/,$var);
foreach (@var)
{
  $var[$i] =~ s/\+/ /g;
  ($key,$value)=split(/=/,$var[$i],2);
  $key =~ s/%(..)/pack("c",hex($1))/ge;
  $value =~ s/%(..)/pack("c",hex($1))/ge;
  $i++;
 }
$file1='/usr/src/apache/htdocs/color.css';
$file2='/usr/src/apache/htdocs/tmp';
open("f1","$file1");
open("f2",">$file2");
while($line=<f1>)
{
 $line =~s/^background-color:.+;$/background-color:$value;/;
 select(f2);$|=1;
 print $line;
}
close(f1);
close(f2);
rename($file2,$file1);
select STDOUT;$|=1;
print "Location:http://144.16.67.108/al.html\n\n";

In this i simply handle the page as a form take the color value from page and put it into the color.css file.

       here is a point to note that if you open a file for read and write it will be a big headache .So to avoid this i first copy the whole file with changed color in to a new file and then rename this file.
 
    Now the Cascading Style Sheet is
<style type ="text/css">
<!--
body{
background-color:green;
font-weight:bold;}
 .col{
font-size:100%;
font-style:italic;
color:red;
}
//-->
</style>
     where colored tags are the open and close tag for style sheet.Program will changed the line which is dark red colored.
    for more colors information click here
    For demo click here.