The CSS (Cascading Style Sheet) is one of the great time savers for any web site designer. Anyone using this simple technique will be able to:
- create a consistent look and feel for a web page
- create customized formatting
- apply this consistent look and feel to a whole web site
- propagate any changes to the style to the whole web site by updating a single file
And then, just to put the the icing the on the cake, a programmer can make the style sheet dynamic by using PHP. If they do that then they can:
- use variables with CSS
- provide customizable style sheets
- alter the styles according to user or user role
However, before starting on the PHP it's worth noting CSS can be used on a web site.
Using a Cascading Style Provide Consistency Across a Web Site
The concept of CSS is quite simple: the styles to be used by a web page are stored in a simple text file, for example:
Here all anchors will:
- be displayed with racing green text and a white background
- change to white text with a racing green background when the mouse pointer is moved over them
If this is saved into "style.css" then it can be picked up and used by any web page that includes it in the opening document head.
Creating a PHP Based Style Sheet
Just like a standard style sheet a PHP style sheet is a simple text file. However, it must include one essential line: