CSS Cookbook

CSS Cookbook

Got something to say?

Share your comments on this topic with other web professionals

In: Reviews > Book Reviews

By Andrew Stevens

Published on November 3, 2004

CSS Cookbook 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.

General format

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.

Book summary

Schmitt’s book contains the following chapters:

Web Typography

Recipes for specifying fonts and font sizes, setting initial caps, styling header elements, pull quotes, paragraph indentation, highlighting text, and line spacing.

Elements

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.

Lists

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.

Forms

Recipes for styling form elements, form buttons, and laying out forms with CSS.

Tables

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.

Page Layouts

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.

Print

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.

Appendix

Lists CSS-related books, Web sites, and other resources.

The book’s complete table of contents is available online, as is the book’s extensive, well-organized index, an archive of the book’s examples and a sample chapter on page elements (1.6M PDF).

The book’s audience

In the book’s preface, Schmitt states that he assumes the book’s readers will have a solid understanding of HTML and are able to edit HTML and CSS by hand without the aid of a WYSWIYG editor like Dreamweaver. He also recommends that the reader have a basic understanding of how to incorporate JavaScript into a page, since a few of his recipes use this technology.

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.

Assessment

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.

CSS Cookbook
ISBN: 0596005768
Christopher Schmitt
O’Reilly, 2004, 270pp.
US $34.95
CDN $50.95
£24.95

Got something to say?

Share your comments  with other professionals (3 comments)

Related Topics: CSS, Web Standards, Web Design

Andrew Stevens grew up in Dublin… no, the other one in Ohio. He currently resides in Bloomington, Indiana.