Surviving the Tall Grass

Web Review
February 1998

I don't know how many of you saw "The Lost World: Jurassic Park," although judging by box office totals, it was probably all of you, plus most of your relatives, twice each. Anyway, for those who did, perhaps you remember the scene where a whole bunch of people go running into the wide-open field of tall grass. Despite someone yelling at them to turn back, they all run out into the field in an attempt to reach safety. And, in the spirit of all great monster movies, the hapless extras are pulled down, one by one, by an unseen enemy (Velociraptors, in this case) which speeds them on to an untimely and fairly messy death.

Is this reminding anyone of their attempts at authoring style sheets, or is it just me?

Cue Ominous Music...

All right, maybe it isn't as bad as all that. Then again, maybe it is. It seems like the more steps we take toward a full implementation of CSS, the further away we get from the point of the entire specification: to be able to construct pages with structurally correct HTML and still be able to make it look good to everyone.

It's that last part that's tripping us up. You can create pages of correct HTML and then apply really great style sheets which look killer in whichever browser you're using. Then, when you load the same page into a different browser... well, it's not a pretty picture. I'll admit, both Netscape and Microsoft have made great strides toward implementing the CSS standard. Just look at the difference between MSIE 3 and 4, on either platform. For that matter, look at the difference between MSIE 4 and Navigator 4. About the same amount of disparity will be seen either way.

Hello? Is Anyone There?

If you think this is an overstatement, just wander over to the newsgroup comp.infosystems.www.authoring.stylesheets (ciwas for short), or visit Web Review's Ask Away group on stylesheets. The majority of posts in either place are questions about why a given style declaration works in Navigator, but not Explorer, or vice versa. Running a close second are questions as to why styles don't have similar effects in both browsers. A distant third are the kinds of posts which really should dominate the group: explanations of how style properties actually work. The only reason such posts are as high as third place is that the browsers' inconsistent and buggy CSS engines necessitate a lot of extra explanation of how properties should work, as opposed to how the browsers actually behave. Bringing up the rear are posts about sites using CSS and tips on interesting ways to combine styles.

This is almost exactly the opposite of the way things should be. It's gotten so bad that the 'inner circle' of ciwas group regulars have been getting progressively more and more bitter and cynical about the use of stylesheets in the Real World. You can read it in the tone of their messages; even the ones who were cynical to begin with are getting almost savage in their disparagement of stylesheet support in the Big Two browsers. They all agree that CSS has a lot of potential, and occasionally someone will share an interesting experiment. When it comes to deploying styles for an entire Web server, though, the consensus seems to be, "don't bother."

For many in the group, the last straw was the release of MSIE 4 for the Macintosh. Although it's much improved over MSIE 3, reports indicate that it's just different enough from the Windows95 version and Navigator 4 to make attempts at "safe" stylesheets a near-impossibility. Most of the problems arise when multiple styles are used; for some reason, the interaction between these properties leads to some interesting display bugs. (For example, using line-height is probably not a good idea, especially in the context of the font property.)

We'll Be Okay If We Stick Together

Fortunately, the community is doing its best to set aside its cynicism and create information which will help authors understand what's going on, and maybe help browser authors see where they can improve their rendering engines. Some of the experts in the group have put together some articles and other analyses of how browser behave, and how one can cope with them. With "A Sense of Style," I try to present CSS the way it should be, but as you've probably noticed, I often have to include sidebars which explain how to make this property or that property behave in one browser or the other. I hate having to do it, but... what other choice do I have?

Hopefully, as time goes on we'll have more consistent style support, and my articles can move from being largely theoretical to being almost entirely practical. That doesn't mean the rest of you get to wait around, though. You need to use styles whenever and wherever you think you can benefit from them. If they work, then let the rest of the world know by posting to the stylesheets newsgroup-- either share your styles, or the URL of your page(s), or both. When they don't work, try to figure out what's causing the problem. Once you've done so, or if you just can't, share the situation with the newsgroup. Someone might be able to help you work around the problem, or at least determine its cause.

Look Out Behind You!

As for us "little people," it would be easy to throw up our hands and say there isn't anything we can do. This would be a mistake, though-- we can do something. Keep experimenting with style sheets, and when you notice inadequacies (not to mention outright errors) in your browser's handling of CSS, report it to the company that provided your browser using their bug-report forms. If you aren't sure that something is in error, check in with the stylesheets newsgroups. We'll do what we can to diagnose the problem, and even give you the URLs of the bug reports forms in case you lost them. (See the end of the article for these and other useful links.)

This whole troubling situation can be, and often is, dismissed as "growing pains" in the specification. After all, it could be argued, any new specification takes time to study, implement, and iron out. I might even accept that line of reasoning, except I've noticed that whenever somebody at one of the Big Two browser shops gets it into their heads to add a new HTML-type tag-- do BLINK or MARQUEE ring any bells?-- it doesn't take a lot of effort to figure out how to add that code.

We Need an Evac, Like Now

To be fair to the coders, the CSS specification is not always a model of clarity. Some sections are ambiguous and confusing, and even those of us who are supposed to be CSS gurus get it mixed up from time to time. However, both Netscape and Microsoft have representatives on the CSS Working Group, and have had for quite some time. If there was a question, why didn't someone just ask?

The situation isn't helped any by fragmentary implementations. Just a little while back, someone on ciwas referred to Netscape Navigator 4.04 as "the roach motel of CSS implementations." This may be true, but don't think for a moment that Netscape stands alone in the buggy behvaior department. (Their problems may be exacerbated by their melding of CSS and JavaScript, but that's another issue entirely.) Internet Explorer suffers from its share of inconsistencies, breakdowns, and general page-mangling, as I alluded to earlier. The final touch, of course, is that the Big Two browsers don't play nice together. Valid CSS declarations which work wonderfully in one browser will violently break the other, and trying to create declarations which will render well in both browsers is starting to become a full-time job for some Web authors. This is a good thing? I think not.

I don't know if the wide gap between Navigator and Explorer is an accident or yet another facet of the ongoing skirmish between Netscape and Microsoft, and frankly I don't really care. The real problem is that the gap is growing wider, leaving would-be CSS developers more and more frustrated. Why? How hard can it be to test out each property one at a time, and not let it into the released version until it's ready for the real world? How hard would it be to get together and agree on which basic properties you're going to implement, and then do it? (All right, maybe that's reaching a bit; after all, why cooperate when you can compete, right?)

Of the people who write those browsers, I ask this:

Yes, there are other things which demand your attention, and that's understood, but CSS is a key piece of technology, now and into the future. Get it right now, and you could have a huge start on implementing XSL. Besides, you would make authors' lives so much easier, and make the Web a better place at the same time.

Until that happy day, Websmiths, please keep experimenting... just watch out for that tall grass.

Useful Links