Style sheets have become ever more popular each year as designers realize that whole web sites can be customized without too much fine editing. They allow properties for the whole site to be set, such as page color, link color, margins, text size, and much more. All of these can be keyed into a single file or in the main body of the code.
The Advantages of Style Sheets - The CLASS and ID tags (Page 3 of 4 )
As shown briefly earlier, style sheet properties can be specified according to the tag -- P, H1, FONT, etc. This is the power of style sheets in styling the page as a seamless process. We can apply a variety of different classes to various tags. Using the internal style sheet example:
This is the same as the example on the first page of this article except that it can set two different colors for the <P> tag lines in the HTML code. They keep the font type and size the same but apply two different colors -- blue and red. Any different style can be applied to the same tag as shown above. Remember that hex values can be applied here too; for example, red would be #990000.
On the first page, it was briefly explained how to apply class names. For the example above, the P tag can be given the two color properties like this:
<p class="colorchoice1"> The text is blue </p><br> <p class="colorchoice2"> The text is red </p>
The resulting displayed text would be:
The text is blue
The text is red
You can also use the ID selector to define any styles for the HTML code. This is done via the # symbol. Looking at the example above: