In: Reviews > Book Reviews
Published on November 3, 2004
When starting to incorporate CSS into designs, Web developers invariably come across problems that will leave them scratching their heads. Just about any experienced developer can recount spending hours trying to accomplish such seemingly simple tasks as centering page content, laying out a form, or indenting lists while learning CSS. If these developers had had Christopher Schmitt’s CSS Cookbook, they would have spent less time poring through specifications and more time creating sites.
The CSS Cookbook, like other books in O’Reilly’s Cookbook series, contains a large number of “recipes” designed to solve problems that developers commonly experience. Like others in the series, this book isn’t intended to be an exhaustive reference. Instead, its goal is to provide quick, easy answers to common problems.
The bulk of Schmitt’s recipes are organized into four sections. The first section, Problem, provides a brief description of the problem that the recipe addresses. The second section, Solution, lists the markup that solves the stated problem, frequently accompanied by screenshots. The third section, Discussion, provides a more in-depth explanation of the solution, alternative solutions, browser quirks related to the problem, and which browsers the stated solution will work for. The final section, See Also, points the reader to online resources where further information on the CSS issues related to the recipe are discussed and/or to other recipes in the book that are related to the current one. Each of these recipes function well as a standalone unit, allowing readers to pick and choose which topics they’d like to explore.
Schmitt’s book contains the following chapters:
Recipes for specifying fonts and font sizes, setting initial caps, styling header elements, pull quotes, paragraph indentation, highlighting text, and line spacing.
Recipes for setting page margins, coloring scrollbars, centering page elements, setting background images, creating page borders, and styling horizontal rules.
Links and Navigation
Recipes for styling links, setting cursor styles, creating CSS rollovers, creating navigation menus, creating breadcrumb lists, and creating rounded tab navigation menus.
Recipes for defining list styles with CSS, indenting lists, creating custom text and image list markers with CSS, creating hanging indents in a list, and moving list markers inside list items.
Recipes for styling form elements, form buttons, and laying out forms with CSS.
Recipes for setting cell spacing, cell padding, and borders with CSS; setting styles for table contents; removing gaps from images in tables; and setting styles for table headers.
Recipes for laying out pages, both purely with CSS and with “hybrid” (tables and CSS) layouts. Includes a number of recipes for multi-column layout.
Recipes outlining tips and techniques for creating print style sheets.
Hacks and Workarounds
Recipes for hiding CSS from browsers that can’t handle more advanced CSS and techniques for working around browser shortcomings.
Designing with CSS
Examples of how CSS can be used to create striking visual effects.
Lists CSS-related books, Web sites, and other resources.
The book’s audience
Outside of these basic requirements, this book would be suitable for anyone interested in honing CSS skills. The CSS novice will be able to employ some of the book’s more basic recipes to start using and experimenting with this technology quickly. The book’s brief recipes and its modular format also allow the reader to choose which aspect of CSS they would like to start exploring and proceed to creating pages with minimal fuss. In this way, the book reminds me of Peachpit Press’ Visual Quickstart Guides, in that Schmitt doesn’t spend too much time on general information, specifications, author opinions, and so on. Instead, he efficiently presents markup that will create a desired effect and shows a screenshot of the final result.
While this book is certainly geared toward the novice, a reader with intermediate knowledge of CSS could find it quite useful. These readers might view some of the more basic recipes as old news, but they might not be familiar with some of the techniques employed in the more advanced recipes. The “Discussion” sections serve as quick, helpful reviews that might reveal superior solutions or nuances of CSS.
In addition to providing a solid overview of CSS techniques, many of Schmitt’s recipes include general design tips that are valuable to anyone, regardless of CSS expertise. These general tips are especially abundant in the book’s final chapter, “Designing with CSS,” which includes design-centric recipes such as “Combining Unlike Elements to Create Contrast” and “Leading the Eye with Contrast.” While Schmitt implements these effects with CSS, the design advice contained in these recipes is applicable to any Web technology.
Schmitt has managed to fit a good amount of useful information into his svelte (by tech-book standards) 270-page book. Of course, there are many aspects of CSS that aren’t covered and many that are covered aren’t discussed in great detail, but this book isn’t meant to be a comprehensive reference. There are a number of solid CSS references already available. Instead, Schmitt has identified some of the most common hang-ups developers new to CSS encounter and has presented concise, efficient solutions to these problems.
This book also includes information on some browser-specific and nonstandard uses of CSS, such as creating blinking text and coloring scrollbars. Schmitt does mention the limited browser support of such techniques, but these sections could have been replaced with ones covering more useful aspects of CSS.
Despite these quibbles, Schmitt has put together a very solid collection of practical solutions to common CSS-related problems that will be especially useful for the developer who is just beginning to dabble with CSS. Most developers new to CSS spend a significant amount of time reading through CSS-related discussion list archives and Web sites to learn the idiosyncrasies of this technology. The CSS Cookbook is like a greatest-hits compilation of CSS tips and techniques found on discussion lists and Web sites, and will undoubtedly save the reader much time.
O’Reilly, 2004, 270pp.