7. Style Sheet Building Blocks
While (X)HTML gives your Web pages their basic structure, CSS (Cascading Style Sheets) defines their appearance.
A style sheet is simply a text file that contains one or more rules that determinethrough properties and valueshow certain elements in your Web page should be displayed. There are CSS properties for controlling such basic formatting as font size and color, layout properties such as positioning and float, and print controls for deciding where page breaks should appear. CSS also has a number of dynamic properties, which allow items to appear and disappear and are useful for creating drop-down menus and other interactive components.
While there are various versions of CSS, the version that is best supported, and which we cover in this book, is CSS 2. Most browsers support most of CSS 2. No major current browser supports it all. I'll point out the places to be wary as we go along.
The wonderful thing about CSS is that it can be created outside of a Web page and then applied to all the pages on your site at once. It is flexible, powerful, and efficient and can save you lots of time and bandwidth.
To get the full benefit of CSS, your Web pages must be well structured. CSS appreciates the fastidiousness of XHTML because then it knows just what it has to do.
|