Introduction

As of HTML 4.0, structure and appearance in web programming have been separated. HTML, which marks things like lists, paragraphs, tables, images, etc, provides the STRUCTURAL markup, saying what something IS rather than what it looks like (for the most part). CSS (Cascading Style Sheets), then, defines all of the APPEARANCE information for HTML code, describing how the HTML-marked text will lay out, what kind of line-spacing it will have, what color it will be, how the background images will tile or be positioned, margin spacing, text indents, etc.

To put it another way, CSS redefines the appearance of HTML tags (over-riding the web browser default settings), and allows for much greater sophistication of text treatment than was possible with HTML alone. CSS even allows you to position elements absolutely on an HTML page with pixel-perfect accuracy, and opens the door to so-called "Dynamic HTML" pages.

In this module, I will outline the most essential features of CSS, in brief. I will not have enough time to really dig into CSS in any depth, but, if you are interested in more information, there is an excellent book available: "Cascading Style Sheets: The Definitive Guide" by Eric A. Meyer, O'Reilly and Associates, Publisher, ISBN#:1-56592-622-6. This book is available by mail-order from my online bookstore, http://www.michaelmasumoto.com/bookstore/. There are also documents that I've written about CSS and CSS-P (positioning) available from my website at http://www.michaelmasumoto.com/.

CSS has been supported by all of the major browsers, to one degree or another, since 1997. Modern CSS implementation is pretty good, but, as long as we are supporting the older version 4 browsers, we must be careful as to which CSS properties we use.

Even today, cross-browser and cross-platform testing is essential to ensure consistent appearance of CSS-defined HTML pages, as CSS implementation varies between browsers and platforms. The latest official information about CSS standards is available from the World Wide Web Consortium (the international web standards organization) at http://www.w3.org/. The various levels of implementation of CSS (or lack thereof) are analyzed and graded at WebReview, http://www.webreview.com/, although much of WebReview's information is also printed in the CSS book mentioned earlier.

Don't expect CSS to be perfect. Although it does improve the appearance of your HTML pages, it does not achieve perfect uniformity of appearance cross-browser and cross-platform. Despite the unevenness of its implementation, however, CSS is still far superior to the FONT tag, or any of the other deprecated tags and attributes from HTML 3.2, and can be an enormous help to you in creating beautiful web pages.

Main Menu