Foreword

Any great chef will tell you that the key to creating good food is using quality ingredients. Author Christopher Schmitt has just gone shopping for you. By compiling hundreds of CSS recipes into this single book, he’s giving you a one-stop shop where you can pick up the ingredients to create stylish, flexible web pages.

When I was first learning the wonders of CSS, trial and error prevailed as my primary means for discovering its creative powers: “Hmm, I’d like to turn this list into a horizontal navigation bar,” or “I need to stylize the components of a form using CSS for a client.” Several hours (or days) would go by after plugging in various CSS rules, removing some, and experimenting with endless combinations. This hit-or-miss approach worked (at times), and although a curious person like me may even consider it “fun,” it sure ate up a lot of time in the process.

I wish I’d had this book. Instead of stumbling upon the solution for styling every element of the page, I could have just thumbed through CSS Cookbook, grabbed the recipe, and started baking. The guesswork would’ve been eliminated, and I could have instead spent my time doing what I love to do best: creating.

The modular nature of this book makes it an indispensable reference for designers and developers of any caliber. Posed with problems from how best to handle typography, links, and navigation to even entire page layouts, Christopher clearly explains not only the styles necessary to complete the task, but also the caveats that may be attached for certain browsers. By additionally explaining the helpful workarounds to everyday CSS problems, he’s arming you with the critical knowledge you need to be a successful CSS designer.

For example, a recent article told of a common usability problem: when posed with a Submit button at the end of a form, some users just can’t shake their double-clicking habits. The button may get clicked twice, with the results of the form getting duplicated. What to do? A solution wasn’t offered in the aforementioned article. However, unsurprisingly, there’s a recipe in this very book that’ll solve this little problem using CSS and a dash of JavaScript.

And that’s the heart of this book’s purpose: real problems and the goods that will deliver real results. You’ve heard about how CSS will simplify your life, making pages lighter and easier to maintain. Now it’s time to start using it, and with this book, you’ll have one less excuse not to.

So, my advice is to clear off a space on your desk because CSS Cookbook will take up permanent residency in the corner. Hopefully for you, that spot will be easily within arm’s reach.

Dan Cederholm

Founder, SimpleBits

Salem, Massachusetts

Get CSS Cookbook, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.