In a recent article, I posed the question of whether the time had finally arrived for cascading style sheets (CSS) to gain widespread use. Companies such as ESPN and Wired have jumped on the CSS bandwagon with full CSS integration in their respective Web sites. However, Builder.com members who posted to the article discussion appear divided on the viability of CSS. You can read all the member postings here.
Most of the responses were split into these two categories:
- For CSS—because browser support will never be uniform, so go ahead and dive in
- Against CSS—because lack of support or consistency among browsers is prohibitive
All browsers are not created equal
With multiple CSS iterations, browser support is seldom uniform. Although Internet Explorer 6 provides rich support for CSS version 2, it does not support every aspect of the standard. Even so, Builder.com member kisom doesn't think that should pose an obstacle. "When have all browsers ever rendered exactly the same? If you keep waiting, you'll keep using tables and image spacers. Why? There are enough browsers out there that are compliant so there is no reason not to use CSS except laziness and ignorance."
This issue has a deja vu feel to it. It makes me think of the early days of HTML development, when Web developers fell in love with the blink tag, and HTML support in browsers was erratic. Netscape developed its own set of HTML extensions and Microsoft did the same; the result was many developers spending countless hours getting their solution to work with both.
Unfortunately, the only way to tackle this problem is by being aware of browser support levels and knowing what browsers will be used by your audience. Browser usage is often controlled in an intranet application, but this is generally not an option for publicly available Internet sites. Numerous resources can help you determine what CSS version or options are supported by a particular browser. Here's a brief list:
I was somewhat surprised by these lists. It appears that Netscape 6 offers the most broad-range CSS support, and Internet Explorer 6 is not far behind.
Not worth the hassle?
Builder.com member ps1 is frustrated by the amount of time required to achieve a consistent look, given the browser inconsistencies. "I'm a BIG pusher of using CSS only in the development of sites. As Tony points out, tables are warranted when displaying tabular data. However, there is still a lack of compliance by browser makers. What should be enjoyable and satisfying becomes frustrating and somewhat maddening. The concept itself is as it should be, but the disjointed approach by the major browsers still produces headaches and unnecessary time and effort spent on workarounds to ensure a consistent site-wide look. I find I spend too [much] time trying to get it right because Internet Explorer 6 displays it one way and Netscape 6 displays it this way, but Opera shows a border, etc….Until the browser makers finally get going and do us all a favor by rendering CSS according to standards, we'll all be confined to a <div style=padding:rubber>room</div>."
Headaches notwithstanding, should we, as developers, wait for uniformity among the browsers before wrapping our arms around CSS?
The time is now
Although Internet Explorer has a commanding lead in the browser market, Netscape, along with Mozilla and Opera, represent a strong minority, and countless other browsers are available. Follow this link to view an abridged list of known browsers. A quick perusal of this list makes it clear that it is not possible to design a site with every browser considered, which would seem to reinforce kisom's call for action from other Web developers.
"If you can't do it with CSS, you shouldn't be doing it. While tables are great for data, as a design mechanism they are cheap and lazy. If major Web sites like ESPN and Wired are moving to CSS, that should say something. A CSS layout will not only give you greater control but also increase the speed of the site. And for older browsers, the site without the style sheet should be just fine. I mean come on, if you're using Netscape 4, you just serve up a lite style sheet and then get by; don't drag down the 95 percent-plus people just because you can't be bothered learning the right way to do it."
This posting makes a strong case for using CSS. Years ago, when I encountered browser HTML inconsistencies, I didn't throw in the towel and avoid HTML. Rather, I worked through the problems and developed solutions that appealed to my audience. As a technology, CSS has evolved through two iterations, with a third in progress. It is a proven technology with obvious benefits. Web developers must use the best technology to build applications, and CSS should be in their toolbox.