Review of CSS Mastery, Second Edition

I don’t read many technical books about web site development with CSS. I probably learned like many of you likely did: online articles, right click/view source, firebug, and a hell of a lot of trial and error. I never take for granted that I’ve been able to provide bacon and diapers for my family by learning from these freely available resources. I’m taking a moment now for that to sink in…. it’s awesome.

You can’t do that and become a surgeon, right? Like you can’t walk up to someone who you know has recently had their appendix removed, right-click, view source, and replay the procedure, saving the information to implement later. If you could, I’d imagine there’d be lots of link bait blogs with headlines like “32+ Ass-Kicking Drugs That Help Prevent Heart Disease You Should be Prescribing to Your Patients, but (Probably) Aren’t.”

Anyway, let’s bring this back home. As easy as it is to find great content all over the internet that would educate you on every possible thing you could imagine regarding what you can do with CSS, there’s nothing like having a book to articulate concepts from beginning to end and provide a coherent narrative of the thought and methodology behind a technique’s implementation. Andy Budd’s CSS Mastery: Advanced Web Standards Solutions, Second Edition, accomplishes this.

CSS Mastery

CSS Mastery isn’t for those just starting out (although anyone would learn something from this book if they are familiar with CSS and HTML). This isn’t something that starts out with how to specify font sizes for the p element. Athough it touches on some fundamentals, you’ll want to have been using CSS for a while in order to get the most out of this book.

Chapter 1 is called “Setting the Foundations”, and addresses the use of meaningful markup, using classes vs ids, different versions of HTML and CSS, DOCTYPE, among other things. It gets your head around some of the parts you don’t learn just by zapping an element on someone else’s site with Firebug. There is a part about microformats that is mentioned here, and though it’s great information, it feels out of place among the other topics in this chapter.

Chapter 2, “Getting Your Styles to Hit the Target”, talks about selectors, specificity, inheritance, style sheet planning and organizing, and style guides. It’s good to know these before you start authoring your CSS style. I appreciated his explanation as to why he prefers one CSS file rather than splitting it up into smaller ones. I’ve noticed other authors advocate splitting them up, so it’s nice to see someone of Budd‘s stature offering some yang to balance the yin. (Note that it all depends on the site in question in anyway.)

Chapter 3, “Visual Formatting Model Overview”, describes the box model, differences with IE, positioning (relative/absolute/etc.) and floating. I particularly found helpful Budd’s description of how inline boxes work, and why they ignore certain properties like height and vertical padding and margins.

Chapter 4 is “Using Backgrounds for Effect”, and talks about using images for list bullets, various rounded corner techniques (including border-radius), multiple background images, opacity (including RGBa), drop shadows, image replacement techniques, and then some. I sensed that this chapter got beefed up a bit with the CSS 3 properties from the previous version of the book.

Chapter 5 is “Styling Links”, and mentions all sorts of interesting ways to play up links, including creating CSS-only tooltips.

Chapter 6 is “Styling Lists and Creating Nav Bars”, which is definitely one of the most common things I get asked about. Not only does this chapter discuss all the various proven methods of creating CSS-styled navigation, but also has a terrific section on how to create Flickr-style image maps.

In Chapter 7, “Styling Forms and Data Tables”, Budd shows how to style a calendar, and what markup he’d use to make various layout methods for a simple form. This is one chapter I think is a little weak. I would’ve loved to have seen this chapter fleshed out much more. The concepts from the calendar can be applied to any table, but it would be nice to see a real data table taken on here, something like what happened here. And though the form concepts mentioned here are common in the wild (like a blog comment form), they feel far from leaving someone with a mastery of tackling forms. It only seems to tackle basic form layout, but nothing further. We’ve seen in Chapter 5 some pizazz he’d throw on links, but what about form fields? What about warning of the inherent dangers of applying styles to form fields?

Chapter 8, “Layout”. This is a meaty chapter, which discusses how to create fixed, elastic, and liquid layouts, and the bonuses of each. Someone could have a field day playing with layouts and techniques used here.

If you’ve forgotten why web developers cuss IE so much, then Chapter 9, “Bugs and Bug Fixing”, will help you remember. The chapter mentions how to find and isolate bugs, and reminds you to “fix the problem, not the symptoms.” It then goes into various IE-releated bugs, why they happen, and how to prevent them. Budd also mentions the concept of graded browser support (‘graded’ as opposed to ‘supported’/’not supported’). Great read.

The final two chapters are the all-new case studies for sample sites “Roma Italia” (by Cameron Moll) and “Climb the Mountains” (by Simon Collison). Moll and Collison walk through their approach to building their sites, and walk you through the implementation of various techniques. These case studies serve as professional models for readers to learn from and experiment with. These aren’t just wireframes or isolated elements – they are fully fleshed out pages, professionally designed and developed by leaders in the field on web development. You’ll hear them describe CSS3 properties in their own words. Although there is some overlap among all three authors in subject matter, this is a pro in two respects: 1) the case studies can be independently of the rest of the book, and 2) what concept may not have congealed under one author would hopefully click with the reader by another.

I have some some minor issues with the book. This book seemed to be written over a span of time while the latest crop of browsers were just coming out. I didn’t see any mention of Internet Explorer 8, which was released in March of last year. Also, whenever a tech book has chunks of code, and we want to illustrate what’s different from one chunk of code to the next, color highlighting is very helpful. And although this book is in color, only Chapter 8 and Chapter 10 appear to use different font colors to illustrate changes in within blocks of code and markup. As I mentioned before, there is some slight overlap in content that the three authors were responsible for. And while this can be helpful, for someone reading the book straight through, it seems a little weird to have concepts re-explained as if the last chapter didn’t just do that. Though I point out these issues, the pros of the book outweigh the cons by a landslide.

I’m sure a question might be from someone who already owns the first edition, as to whether they benefit from purchasing the second. In my opinion, no. I should restate that I didn’t read the first edition, so take this all with a grain of salt, and I also don’t pick up CSS books on a regular basis. But I would imagine anyone who has read the first edition and has also regularly kept up with web sites like the authors’ blogs, 23ways.org, alistapart.com, css-tricks.com, etc., that person may not get much more from this text. However, if you feel out of practice with CSS sites and were wondering if you should brush off your old copy to read again, then get this one instead.

Recommended. $26. Available from Amazon.