Standards sticklership [Re: [vox-tech] Fwd: css: cell width and height]

Micah Cowan micah at cowan.name
Sun Dec 17 13:16:01 PST 2006


> From: Peter Salzman <p at cbreak.com>
> 
> I'm always amazed that I aced through a year of quantum field theory but CSS
> continually baffles me to no end.
> 
> If I have some html tables, and set the height and width CSS property for
> each td element, is it guaranteed that each cell in each table will be the
> exact same height and width under all circumstances?
> 
> If not, is there some way of saying "Look here, browser.  As Zeus is my
> witness, you will make this cell 3em by 2em no matter what!"

I'm pretty sure the answer is: no. I don't think there's a way to make
an absolute guarantee that your size will not change.

There's something you should know about CSS, too: it is a very powerful
and flexible stylesheet language, but it's not quite complete, and
support for it in any browser I can think of has never been, either
(this includes Firefox and Opera, though AFAIK Opera is the better of
the two in that regard). This and other W3C specifications insist that
CSS should always be used for formatting instead of things like tables,
and yet they have more or less failed to provide some of the /precise/
levels of control available via old-fashioned, reliable-but-deprecated
HTML table formatting (or, in some cases, mainstream support for CSS has
failed to provide the appropriate level of precise control demanded by
the spec). I am ignoring the "cheat" of using CSS to trick the browser
into thinking that a given element should be rendered as a table or
table cell: that amounts to pretty much the same thing, in the end.

For this reason, CSS is one of those things where it is often impossible
to be both pragmatic /and/ completely correct (from a standards
perspective). This actually is true of HTML itself in certain cases as
well. I myself am very much a standards stickler, and tried for years to
write only ever standard-conforming code (as I still pretty much
continue to do with C and C++). This is not possible in many
applications.

So: use CSS wherever possible. It is by far the best choice, where it is
reliably supported. Where you can't get CSS to do what you need it to on
all of your target browsers, don't be afraid to use HTML tables or other
tried-and-true tricks in defiance of W3C recommendations. Web markup and
formatting technologies is one of the worst areas for trying to match up
specifications with real-world implementations support :(

-- 
Still lamenting MSIE's abysmal support for the <object/> tag...

Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/




More information about the vox-tech mailing list