A bit of web design

» In which we fight CSS and browser incompatibilities.

This weekend I experimented with some web design ideas, involving CSS and Javascript. The resulting site designs are not online yet, but here are a few remarks and thoughts...

1. It's soooo tempting to use tables for layout. I mean, all you have to do it stick content in it, set sizes and alignment here and there, and it does what you want. If you try to get the same effects using CSS, chances are you'll still be working on it hours later, gnashing your teeth in frustration, all the while looking up documentation and pushing around floats and margins.

2. Internet Explorer is teh suk. Of course we knew this, but I was confronted with it once again today. Standards-compliant code that works well in Firefox, might not work at all in IE. In this case, I ran into problems with setAttribute, which is, shall we say, underpowered in IE. Setting the "class" attribute does not work (use "className" instead), and neither does setting "onclick" unless you follow it up with some weird, redundant-looking code. I'm sure this is old news for seasoned web developers and designers. How something can be so broken and yet so ubiquitous is astonishing.

(It turned out that Opera isn't without problems either; if we have <a href="#foo">, then in Opera, a.getAttribute("href") returns the whole URL, while Firefox and Safari return "#foo". I'm not sure which one is correct. In any case, I had to work around it.)

Anyway, after a lot of trial and error, I now have Javascript code that works correctly (or so it seems) on Firefox, Safari, Opera and IE. But what a pain. I don't envy those who have to do this on a daily basis.