Book Review: Everything You Know About CSS is Wrong
Everything You Know About CSS is Wrong? You whaaaat? You cheeky little ****ers!
Well, that was the first thing I thought when I read the email subject line for this latest book by Rachel Andrew (co-written with SitePointer Kevin Yank). Way to get a CSS developer's attention right there! And to be fair, I think that was intentional on SitePoint's part, otherwise this might be viewed as just another CSS book, written by an author who has already put a few of them out.
So, how is that I - and apparently many others - have it wrong? Well, we haven't exactly been doing things wrong, as such. Developers that stopped using tables for layout were definitely doing the right thing, and in doing so also helped to improve the accessibility of their web pages, potentially improving search engines' views of the content and other usability benefits. But crikey, doing a CSS layout can be very hard sometimes! It's not surprising that many old school, dyed-in-the-wool web developers found themselves trying to learn CSS layout techniques but still coming back to the 'old faithful' - the table element. But those who stuck at it used techniques such as absolute positioning, floated layouts and all other kinds of layout approaches. In most cases, though, what they would be trying to achieve was a grid-like layout, something that a table immediately lends itself to.
So begins this book's first task - trying to sell the concept of using table metaphors to experienced CSS developers who have spent years disassociating themselves from such things. It's important to say at this stage that the authors are not suggesting using the CSS table layout display properties (
display:table-row etc) for actual tabular data - this is clearly a job for a real table! Rather they are showing how the CSS display properties should be used to affect table-like layouts without the issues that you can have when doing the same with other CSS approaches (such as mismatched row heights and so on)
The reason why this book is coming out now should also be noted - Internet Explorer version 8. Until IE8, the techniques in this book were about as much good as an investment banker's promise. Fine if you are only expecting the site to work in FireFox, Safari and Opera, but useless if you want the site to render in Internet Explorer. IE8 adds the support for these table layout properties and with it opens the door to new layout techniques that have a fighting chance of working for a reasonable audience percentage. And once the usage figures for IE7 and IE6 fall away, you might well think that floated CSS layouts and their ilk are 'the wrong way'. But that day is still a way off, and so on to the final parts of the book ...
The authors recommend a transitionary approach whereby you start to use CSS table layouts but have a simplified style sheet - pulled in using conditional comments - for IE7 and earlier. How many people will feel comfortable doing this in the early days of IE8 is questionable, but the argument for trying it out is simple - unless we innovate we'll forever be using techniques that are, to one extent or another, hacky. Someone's got to be the first to start championing these methods.
This is not a big book by SitePoint's standards - it's almost an appendix to previous CSS books by SitePoint, a 'things that couldn't be said/suggested before because they would have been a waste of time' kind of book. And of course it's timely, with IE8 just around the corner. It's interesting as a web developer to pick up something like this and realise that there are new ways to do things that we couldn't conceive before, and I'll certainly be keeping these at the back of my mind. The sooner that IE8 can be adopted, the better, and these techniques can start to get a proper working out. Who knows, there may be a whole new raft of tricks that will arise as a result of these CSS table layout properties?
So, in summary - I would recommend CSS-savvy developers get a copy and learn about the techniques but don't be surprised if, having read the book and tried out a couple of examples, they then file the book away for a year or two before being able to use it again 'in anger'.
[Full disclosure: I have written for SitePoint also. This does not affect my opinion of this book. In fact, I might even have scored the book higher - it is well written! - but its lower scores are simply as a result of its narrow breadth and the fact that for the time being its appropriateness for usage is not quite up there]
Rating (out of ten)
|Appropriateness for beginners:||
|Variety of topics covered:||
|Title||Everything You Know About CSS is Wrong|
|Where to buy||SitePoint, Amazon|
|Written by||Rachel Andrew & Kevin Yank|