Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.
Style sheets describe how documents are presented on screens, in print, or perhaps how they are pronounced. W3C has actively promoted the use of style sheets on the Web since the Consortium was founded in 1994. The Style Activity has produced several W3C Recommendations (CSS1, CSS2, XPath, XSLT). CSS especially is widely implemented in browsers.
By attaching style sheets to structured documents on the Web (e.g. HTML), authors and readers can influence the presentation of documents without sacrificing device-independence or adding new HTML tags.
The easiest way to start experimenting with style sheets is to find a browser that supports CSS. Discussions about style sheets are carried out on the www-style@w3.org mailing list and on comp.infosystems.www.authoring.stylesheets.
Example of CSS Code[]
h1 { color: white; background: orange; }
p { font-style: Arial; color: red; }
The W3C Style Activity is also developing XSL, which consists of a combination of XSLT and “Formatting Objects” (XSL-FO).
The fact that W3C has developed XSL in addition to CSS has caused some confusion. Why develop a second style sheet language when implementors haven't even finished the first one? The answer can be found in the table below:
CSS XSL
Can be used with HTML? yes no
Can be used with XML? yes yes
Transformation language? no yes
Syntax CSS XML
The unique features are that CSS can be used to style HTML & XML documents. XSL, on the other hand, is able to transform documents. For example, XSL can be used to transform XML data into HTML/CSS documents on the Web server. This way, the two languages complement each other and can be used together.
Both languages can be used to style XML documents.
CSS and XSL use the same underlying formatting model and designers therefore have access to the same formatting features in both languages. W3C will work hard to ensure that interoperable implementations of the formatting model are available.
A W3C Note on "Using XSL and CSS together" is available.