Download free PDF version
Welcome to the DevGuru Cascading Style Sheets Quick Reference guide. This is a useful 166 page reference source that defines and explains all of the various style sheet properties, values, and displays sample code.
Cascading Style Sheets (CSS) is a declarative language that is used to enhance the HTML language. CSS is user friendly and was purposely designed to be very readable and writable. The terminology of CSS is lifted from the terminology of desktop publishing. A minimum amount of coding can create sophisticated web pages that have a common theme in appearance.
The early history of style sheets can be described as slightly chaotic. In particular, browser compatibility proved to be a major issue for the first developers who delved into CSS. To help rectify this problem, the World Wide Web Consortium (W3C) published a set of standards in December 1996 referred to as the "Cascading Style Sheets, Level 1" standards. This was followed in December 1998 by the "Cascading Style Sheets, Level 2" standards. Level 2 was a major revision that almost doubled the size of the CSS language by adding 42 new properties.
This Quick Reference documents the Level 2 standards, which are commonly referred to as CSS2.
Internet Explorer Version 5.5, and to a lesser extent Netscape 6, are fairly compatible with most of the W3C Cascading Style Sheet Level 2 standards. The key word here is most. Neither Internet Explorer nor Netscape recognize all of the W3C standards for Level 1 or Level 2. Further complicating matters is the fact that some companies have created proprietary properties that only work on their browser. So, browser compatibility issues still remain a problem for all versions of all browsers available on the Internet. Therefore, while coding, a developer would be wise to view his or her Web pages on a variety of browsers.
Here is a very simple example of using CSS: The word red is red.
Below is the code. Note how the red color is declared using a style statement inside a pair of HTML span tags. The style is applied to all text between the opening and closing tags. Therefore, the closing tag is mandatory.
<b>The word <span style="color: red;">red</span> is red.</b>
However, a far more useful approach is to declare style properties inside the &<head> ... &</head> portion of an HTML file and associate that property with some specified selector keyword.
The effects of declaring several style properties can cascade together into creating the final appearance of the page. Used properly, CSS can allow you to create an entire Web site (such as DevGuru) with a consistent appearance in design. This is done by creating one .css file that contains all of the style rules for the entire site. Each page is linked to the style file using the HTML link tag:
<link rel="stylesheet" type="text/css" href="/Include/StyleRules.css">
While CSS is not case sensitive, it is recommended that you use only lower case.
Meanwhile, on 19 January 2001, W3C released a working draft on CSS3 which proposes to modularize the CSS specifications. So, the future of Cascading Style Sheets promises to be very evolutionary.