The first in a two-part tutorial on Cascading Style Sheets, thisarticle explains how to create and use style rules across your Web site,and then demosntrates a few basic CSS properties. Also included:inheritance, classes, contextual selectors and some lightbulb jokes.
Now that all the theory's out of the way, how about actually getting down with some of the basic CSS properties available?First on the list is the "color" property. As you've seen in the examples above, this property controls the foreground colour of an HTML element, and comes in very handy when you need to change the colour of different blocks of text. The example below turns all italicized text blue.
<HEAD> <STYLE TYPE="text/css"> I {color: blue) </STYLE> </HEAD>
CSS offers a number of different ways to specify the colour value here. The simplest is to use one of the sixteen pre-defined colour names available - aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow. You can also specify a hexadecimal colour combination by prefixing it with a #I {color:#0000FF) or a combination of RGB values in absolute or percentage terms, like this:I {color: rgb (0, 0, 255))I {color: rgb (0%, 0%, 100%))Following close on the heels of "color" comes "background-color", which controls the background colour of an HTML element.