Logo         Community
The Company
Your Account
Contact Us
Understanding Style Sheets (part 1)
Learn how to create and use style sheets across your Web site

| Ground Rules |

Now that you've seen the power of style sheets in action, let's get down and dirty with some basic concepts. In the example above, the line

B {color: lime}

is known as a "style rule", which consists of two basic elements - a "selector" and a "declaration".

A "selector" is usually an HTML tag [B, in this case],while the "declaration" is one or more CSS name-value pairs that indicate the type of formatting to be applied to the selector. This declaration is always enclosed in curly braces, and different name-value pairs are separated from each other by semi-colons. For example,

B {color: lime; text-decoration: underline; font-family: Arial}

is a perfectly valid style rule

The CSS specification lays down definitions for more than sixty keywords, and you're going to learn all the important ones during the course of this tutorial.

Selectors can also be grouped together, as in the following example, which turns all H1, H2, and H3 text white:

H1 H2 H3 {color: white} /* this rule turns H1, H2 and H3 blocks white */

Note that you can also include comments within your style block, as demonstrated above.

The most common method of including a set of style rules in an HTML document is via the <STYLE> tag. The <STYLE> tag usually appears within the <HEAD> of your HTML document, and looks something like this:


<STYLE TYPE="text/css">
...style rules go here...


If you take a look at the examples above, you'll see that this is the method used. Style rules defined in such a manner will apply to the current document only...which creates a problem if you'd like to apply styles across a series of Web pages. Not to worry...a solution is at hand!

How to do Everything with PHP & MySQL
How to do Everything with PHP & MySQL, the best-selling book by Melonfire, explains how to take full advantage of PHP's built-in support for MySQL and link the results of database queries to Web pages. You'll get full details on PHP programming and MySQL database development, and then you'll learn to use these two cutting-edge technologies together. Easy-to-follow sample applications include a PHP online shopping cart, a MySQL order tracking system, and a PHP/MySQL news publishing system.

Read more, or grab your copy now!

previous page more like this  print this article  next page
In trog...
Logging With PHP
Building A Quick-And-Dirty PHP/MySQL Publishing System
Output Buffering With PHP
Date/Time Processing With PHP
Creating Web Calendars With The PEAR Calendar Class
In the hitg report...
Crime Scenes
Animal Attraction
Lord Of The Strings
In boombox...
Patience - George Michael
Think Tank - Blur
My Private Nation - Train
In colophon...
Hostage - Robert Crais
The Dead Heart - Douglas Kennedy
Right As Rain - George Pelecanos
In cut!...
American Chai
The Core
Find out how you can use this article on your own Web site!

Copyright © 1998-2018 Melonfire. All rights reserved
Terms and Conditions | Feedback