Before you BBQ me - note the word layout here. I'm not opposed to CSS. Instead don't get me started about crappy web sites that use "font size=+5 face=Arial" in every sentence or are even just saved from Micro$oft W*rd "as HTML". CSS is great for styling your contents. How do I want to make my H1 heading look like? How much space does a P paragraph have above and below? Which font style do I want to use? That's what CSS is good for. I like it. Keeps my (X)HTML clean and readable. And the CSS if often pretty readable, too, even if you are a web design mortal. But the worst thing that was ever attempted in CSS is (ab)using it to create page layouts. By layouts I mean multiple columns on a web site for example. There are hacks to accomplish that. But CSS was never conceived for complex page layouts. Would you use OpenOffice style sheets to position certain elements across your stationary? No, you use it for styling elements. Hacks are often cool. But they are no paradigm to improve the web world. "Just use a float or two and define widths and that's it.", right? CSS evanglists even talk about "fluid designs". IMHO it's not really fluid because you need to fix your floats. There is no way to say "this DIV should be as wide as the widest text in it". Your only ways are to specify the width as percentages or as absolute pixels. Most people seem to use absolute pixels. Now how poor is that? I'm designing a fluid web site that is supposed to work on any monitor and I'm dealing with pixels? Many web design documentations say that you should stay away from pixels. Specify your text size in "em" instead so that the user can choose the font size. And now all of a sudden I'm supposed to assume that some random navigation column is supposed to be 235 pixels wide? Everybody is complaining about crappy web sites saying: "This web site was optimized for 1024x768". Why not even say "You should have a good glass of red wine at the right temperature, a furry animal on your lap and dimmed your ceiling light when watching this web site."? (Yes, that's how I prefer to spend my time on the web.) Web designers seem to use the mathemical average resolution and use that for their design. Have they ever tried to view the web site on a monitor with a much larger resolution? Have they bothered to try it on a mobile phone? No. It just looked cool on their monitor. Browse most cool CSS-layouted pages on your BlackBerry and you will see the whole mess. Because 235 pixels on a mobile device may well cover up the whole width of the display. So what is my proposal? Use the crappy tables again? Aren't they supposed to be used for tabular data only? Yes, actually the solution is tables. Because there is still no other way to do proper layouts. And the kind of tables I'm think of is "left colum + center column + right column" with the center column occupying 99% of the width. Job done. I'm not talking about tables with invisible 1x1 pixel GIFs that serve as spacers to control the size of each column done by people who got told that web sites are done with DreamWeaver. Perhaps we need three different way to describe a web site:
- HTML: to define the content
- CSS: to style the content
- whatever: to define the page layout
So long tables do have their right to exist because:
- You don't have to specify widths in pixels thus rendering the columns to the exact width that is necessary.
- You don't need hacky CSS that will likely not work in 5 years.
- Your web pages will look good on any browser.