to the main page about the tutorial  THE XML REVOLUTION  -  TECHNOLOGIES FOR THE FUTURE WEB back up next

A tiny stylesheet

A CSS stylesheet is a collection of selectors and properties:

B {color:red;}
B B {color:blue;}
B.foo {color:green;}
B B.foo {color:yellow;}
B.bar {color:maroon;}

In the HTML document, the most specific properties are chosen, so:

<b class=foo>Hey!</b> 
<b>Wow!! 
   <b>Amazing!!!</b> 
   <b class=foo>Impressive!!!!</b>
   <b class=bar>k00l!!!!!</b>
   <i>Fantastic!!!!!!</i>
</b>

gives the result:

Hey! Wow!! Amazing!!! Impressive!!!! k00l!!!!! Fantastic!!!!!!

When properly used, the physical layout (a CSS file) is separated from the logical structure and the actual contents (a HTML file).

The default layout in a browser corresponds to a default stylesheet.

back COPYRIGHT © 2000-2003 ANDERS MØLLER & MICHAEL I. SCHWARTZBACH next