|
|||||||||||
|
Style sheets provide a means for authors to specify how they wish documents written in a markup language such as XML or HTML to be formatted. For example, an author might wish to specify that a document should be green on pink - this could be done using CSS, an established standard for styling documents.
You might ask 'Why do we need style sheets - can't you use HTML; for example, the FONT element or the bgcolor attribute?'
There are two answers to this:
Style sheets solve all of these problems. For example, say you want to make all those headings green Arial - no problem, just type H1 {font-family: Arial; color: green}. What if you want to change all of the headings on your site to red with a blue background? Just change that to H1 {color: red; background: blue}, and, at a stroke, the whole of the site is changed.
To take an example, on this page all of the headings are reddish brown - this is so on every page on RichInStyle.com. This probably adds up to about 10000 headings.
If each of those headings were to be styled with a font element (e.g., <H2><font color="blue">A heading</font></h1>), that would take up 250kb - a significant amount of space. By replacing this with a CSS rule, the whole site can be styled with a single rule amounting to only about 40 bytes.
Assuming an average of 50,000 downloads per page, per month, that works out at a saving of 12.5gb.
That is a lot of saved space, especially if you pay for bandwidth by the gigabyte.
Just imagine the cumulative effect of that across all the margins, colors and fonts on the site, and that is a lot of saved traffic, so not only are cost reduced, but also the download speed will increase for viewers of your pages.
To give another example of the power of style sheets, have a look at RichInStyle.com's personalization page. This allows you, as the viewer of a page, to say 'I don't like the way that that page looks, I'd rather have it white on blue', and for that desire to be fulfilled.
This technology, unique to RichInStyle.com, and only achievable using style sheets, gives you total power, and your users total control (does your user have vision difficulties? - no problem, they can select a high contrast style sheet), and best of all, it is free for download from RichInStyle.com.
Style sheets have the following advantages:
Be aware that since CSS is a large specification, most browsers do not support it in its entirety. Given that this is so, don't be surprised if some concepts described in this guide don't work. To see whether they do, you should check out RichInStyle.com's bug table.
Style sheets allow you to say, for example, that you want headings in 24pt Arial with a pink background, that you want the whole document to have a left margin of 1in, or whatever. The good thing about them is that they are the only way that you can say that you want BODY or P to be displayed in a certain way - in HTML you could make all P tags a certain color using HTML tags, but if you wanted to change them it would take hours on a big website, but seconds using CSS.
For example:
BODY {color: red;
background-color: white;
font-size: 16px;
font-family: Arial;
line-height: 20px;
margin-left: 5%}
As you can see, creating a style sheet is easy, but before you can do that, it is necessary to decide how you are going to apply your style to your page. This topic is covered in the next section.
Copyright © RichInStyle.com 2000; all rights reserved. See copyright document for terms of use. Please visit Bukit Lawang flood appeal.