Home

 

Cascading style sheets (CSS)

Although Web developers can use HTML tags to specify styling attributes, the best practice is to use a cascading style sheet (CSS). A CSS file defines a hierarchical set of style rules that the creator of an HTML (or XML) file uses in order to control how that page is rendered in a browser or viewer, or how it is printed.

CSS allows for separation of presentation content of documents from the content of documents. A CSS file can be referenced by an entire Web site to provide continuity to titles, fonts, and colors.

Next we provide a rule for setting the H2 elements to the color red. Rules are made up of two parts: Selector and declaration. The selector (H2) is the link between the HTML document and the style sheet, and all HTML element types are possible selectors. The declaration has two parts: Property (color) and value (red):

H2 { color: red }

More information about CSS can be found at:

http://www.w3.org/Style/CSS/
ibm.com/redbooks