Author: Denise R. Jacobs
Publisher: New Riders, 2010
Aimed at: Anyone who hand crafts or debugs CSS
Pros: Logical approach
Cons: Style might irritate some readers
Reviewed by: David Conrad
Do you tackle CSS bugs as if you were a detective? This book explains that this is the right way to do it.
What this means is that when the layout of a web page goes wrong it is likely to be the CSS - hence this book.
It has the subtitle "Tricks for solving tough CSS mysteries" but the author does much more than provide tricks. The basic idea is that you tackle a CSS problem much like a CSI or a detective would deal with solving a crime. Hence the book is replete with lots of detective-y references. These are mostly ok, and even raise a smile now and again, but I can imagine that it might irritate some readers.
Similarly all of the common bugs are given names like "Peekaboo bug", "Guillotine bug" and so on. If you think these names are silly, then make up your own names, but giving things a descriptive name is a great idea. Programmers do it all the time but in this case they are abstracted and made to seem difficult by being called "patterns" and "anti-patterns" - so much better to call something the "peekaboo bug" and make it sound approachable than to call it the "float semantic nesting seriation bug"....
The book opens with a good explanation of CSS and HTML - not for the beginner but for the reader who think they know how things work. After reading the first four chapters you should have a much better understanding of CSS and the HTML it formats and be ready to follow how things go wrong and how to fix them.
The second part of the book "The Game's Afoot", a Sherlock Holmes quote, presents six case studies each in the form of a crime to solve - the case of the devilish details, the case of the mistaken identity, the case of the single white space, the case of the float, the case of the browser, and the case of the LOL layout. All great stuff, clever and logical with lots of explanations of how the solutions are found and the thinking that reveals the culprit. Again you need to have a tolerance for a detective format and lots of very long listings - perhaps too long. It is at this point you start to think that CSS was never really intended for human consumption and getting a good automatic tool on the job might be a better idea than hand crafting CSS/HTML.
Similarly a lot can be found out using the developer tools built into say Firefox and IE. For example, if you have a layout problem IE will show you the inheritance tree for any element and it will even allow you to modify properties interactively and instantly show you the result. Trying to solve CSS problems without the help of this sort of tool really is like giving up the mass spectrometer and DNA profiling and using nothing but Sherlock's magnifying glass and logic.
As long as people hand craft CSS in this way there will be CSS crimes to solve and even with the best tools in the world the sort of logical approach described in this book is going to be invaluable in finding the problem and in fixing it correctly.
This isn't a book that will appeal to every reader - you need to first know a reasonable amount about CSS and you need to be prepared to learn a lot more - but if you want to master the subject this is a very good and fun way to learn.