HTML and CSS Reference
creates blinking text in Firefox, while this markup
<marquee> Sale! Sale! Sale! All Presentation Tags Must Go!!! </marquee>
animates text in nearly any browser. History has already been written. Like it or not,
markup has been used to visually present Web pages for well over a decade.
The problem with using HTML for formatting is that it just isn't really very good at it,
nor was it generally designed for it. For example, just to make some centered red text with a
yellow background, you'd likely resort to using markup like so:
<table align="center" width="100%">
<td bgcolor="yellow" align="center">
face="Arial, Helvetica, sans-serif">
Big Red HTML Text
When using HTML for Web page presentation, we see a tremendous amount of markup
being used to style the page, often filled with complex stacked or even nested tables. Layout
workarounds using invisible pixel images, proprietary elements and attributes, text in images,
and other arcane ideas were, and often still are, required to deliver quality, high-fidelity
design in HTML. Fortunately, for now and the future, there is a better way—style sheets.
The Slow Rise of CSS
Cascading Style Sheets (www.w3.org/Style/CSS/) offers what Web designers have been
clamoring for over the years: more control over layout. Interestingly, the excitement about
CSS has been quite slow to build. CSS1 marked its first appearance as a standard in late
1996 and CSS2 quickly followed in 1998. Early browsers such as Internet Explorer 3 and
Netscape 4 supported some of the technology, but CSS has had trouble gaining widespread
acceptance. Browser support has been quite inconsistent, and significant bugs, particularly
in older of versions of Internet Explorer, have made the use of CSS a lesson in frustration.
For visual proof of this, consider the CSS2 conformance tests called Acid2 (www.acidtests
.org/), which exercises many important features of CSS1 and CSS2. Figure 4-1 shows
Internet Explorer 6 and Firefox 2 both failing this test. However, with the release of Internet
Explorer 8 and Firefox 3 and past conformance of other browsers like Opera and Safari, all
the major browsers now pass the Acid2 test (see Figure 4-2). Considering that the
introduction of that test was in 2005 and for many years previous CSS support was spotty,
finally we see that CSS is changing for the better!
N OTE As this edition goes to print, many browsers pass Acid3 as well. The point here is to show
that in the past few years CSS has become viable and appropriate, and that it took a while to get
there, rather than to declare any browser a winner or loser in a standards race.