CSS Cookbook
Several hundred solutions to common CSS related tasks all in the one book. This book almost manages to live up to the claim at the top of the front cover as despite its many flaws it does provide quick solutions to common CSS problems. A significant improvement over the second edition.
My Rating: ![]()
![]()
![]()
![]()
Pros
- Presents practical solutions to many common problems people have with CSS
- Logical divisions within the book to make the solutions easy to find
- Discussion of font embedding not only demonstrates how to use multiple font versions for cross browser support, it also contains a good discussion of the licencing issues of font embedding and how to avoid it.
Cons
- Much of the information about HTML is wrong (for example: HTML 4 is the current standard so the argument that it is not too old to use doesn't make sense, also HTML 5 doesn't have an SGML doctype and the HTML tag it uses instead is identical to the short version of the doctype that is valid for HTML 2 through HTML 4).
- A number of code samples include processing required for really old browsers such as IE2 - no one uses such old browsers any more so why not use more modern code (for example the HTML comment on page 35).
- Many examples have poorly structured HTML - for example tables without a tbody, forms without labels. Some of the forms that do have labels are missing the id attributes to attach the labels to the appropriate form fields.
- The alternate stylesheet example on page 88 is incorrectly coded - if it were coded correctly then it would work better with the browser it claims don't support it.
- Doesn't cover how to use CSS tables.
Description
- Third Edition: Copyright December 2009
- 702 page paperback
- Published by O'Reilly Media
- ISBN 978-0-596-15593-3
- Author Christopher Schmitt
Review
Despite the many flaws in the HTML that the book uses, there are a great many extremely useful examples of how to use CSS to achieve a large range of commonly wanted appearances in your web page.Once you get past the antiquated code required for browsers back in the 1990s and the examples based on the presumed HTML 5 standard of the 2020s (assuming that it doesn't change too much between now and then), the rest of the book mostly achieves exactly what you would expect it to - to show you how to produce the appearance that you want across all the current browsers in common use.Most of the things you are likely to need to do in your web page including a number of more advanced tasks that probably will not be needed very often can all be found in this book. Not only is all the necessary code included but there are also explanations of why it is coded the way it is and the problems that can arise if you don't do it that way.
The book hasn't been updated as much as it perhaps ought to have been since wrapping the in page styles inside an HTML comment is not required for any browser that anyone uses any more. Page 121 continues to spread the myth that setting the body font size to 62.5% will make your font sizes more cross browser compatible where in fact any percentage will do the same so you may as well use 100% since the reason why people chose 62.5% was based on a misunderstanding of the relationship between pixels and ems. There are also a number of typos including some in the code samples (for example on page 109 there is a reference to a font called 'Area').
The existance of the Opera web browser is mostly overlooked in the book. Many of the statements that list which browsers support a particular piece of code neglect to mention Opera at all. For example the section on page 273 discussing the proprietary code that can be used to create coloured scrollbars in IE and Safari doesn't mention that Opera also supports the IE version although that is off by default in Opera and on by default in IE.
Some of the introductory information could also have been presented better. For example on page 74 there is a list showing the order of precedence as to which styles take precedence. That list gives the impression that author styles always take precedence over user styles. The correct situation is only explained two pages later where it properly states that user styles marked !important (which all user styles would be otherwise what's the point in having them) override author styles. I was also a little disappointed that the book chooses some of the proposed HTML 5 tags for some of the examples. Surely examples of how to do audio and video properly using the current HTML 4 standard object tag would be far more useful than the examples using the audio and video tags that are currently proposed for the new standard as alternatives to using the object tag. I would not suggest this book for someone trying to learn CSS - there are a great many better books available for that purpose. This book isn't really aimed at that audience anyway. The best use for this book is for someone who already knows at least the basics of CSS who wants to find out how to complete a specific task. A quick lookup of that task in the book's contents should take you straight to the two or three pages of information that are exactly what you are looking for. When using the book that way, almost all of the flaws I have mentioned are not going to make any difference to you as you will already have properly written HTML that the supplied CSS will work with quite well.
More Information from the Publisher
Note that I wrote a draft of this review first before comparing it with my review of the second edition. The only change made after I reread my review of the prior edition was to comment on how much the book has improved.



