Title: Cascading Style Sheets: Separating Content from Presentation
You're a fairly competent HTML coder, but you know it's time you got some style. Or maybe you've got style, but know it could be better. If you're ready to cross over to the world of cascading style sheets, or if you know the basics but want a better grasp of the overall picture and the practical details, the Fantastic Four have done an excellent job of showing the way.
"Cascading Style Sheets: Separating Content from Presentation" has ten chapters divided into three sections, "CSS and XHTML Overview", "Writing CSS and XHTML Pages", and "The Real World." Also included is a section of three CSS projects which demonstrate in great detail the principles taught by the authors. A complete table of contents is available at the the publisher's website.
Beginners will want to begin at the very beginning, including the introduction. Keep in mind, these guys aren't dry academic types who felt compelled to fill the introduction with useless arcana; it's a useful part of the book.
Even advanced coders will probably pick up more than a few points in the first section, "CSS and XHTML Overview." Chapter 1, "Foundation Concepts" does a thorough job of summarizing the difference between structure and presentation, and why we should care. I found it elucidating even though I'm not a beginner. Chapter 2, "Overview of Presentation", includes a great exercise in identifying presentation concepts; analyzing an existing site to see how presentation, how things 'look', is conveyed. This chapter includes some elementary information on applying markup to the components of the document.
"Markup with Meaning", the third chapter, begins by explaining, in simple terms, XML's ability to create custom vocabularies, then follows with an explanation of why we can achieve similar benefits with the more generic structures of XHTML. The rest of the chapter is devoted to document analysis. As we delve into structure and presentation, understanding the structure of the documents we're working with is essential to proper use of the tools we're learning about. Sufficient time is spent explaining how to deconstruct existing documents, electronic or other, in order to apply the skills we're about to gain.
In section II, "Writing CSS and XHTML Pages", we actually get to create some styles. Chapter 4, "Fundamentals", is perhaps the single most meaningful chapter I've read about cascading style sheets. It clearly explains basic concepts such as inheritance, the cascade, and the box model. Author Owen Briggs illustrates virtually all the fundamentals in enough detail to truly lay the foundation for the rest of this section, and indeed, your ability to use styles correctly.
And now, to the really fun stuff — in chapter 5, "Rules" we finally see how to write style rules. This 12-page chapter is the one where my bookmark lives; it's a handy reference when I'm stuck on syntax or concepts. To apply styles to our markup, chapter 6 covers "Attaching CSS to your Markup" via inline, embedded, and external style sheets. Each is explained in detail, and the advantages and disadvantages are covered well enough to allow even a beginner to make intelligent decisions about their proper use. Also included is basic information on alternate, persistent, and preferred stylesheets, concepts new to me.
Next, typographer Matt Patterson drives the final nail in the
<font> tag's coffin with his clear and complete discussion of "Typography" in chapter 7. After explaining typographic terminology, important in understanding the concepts to follow, Patterson covers in detail font faces, size, color, spacing, and how to apply this smorgasbord to every kind of textual element. Owen Briggs describes the box model so deliciously in chapter 8, "Boxes, Boxes, Boxes" that I just had to experiment. The important concept of 'flow' is detailed, providing the necessary foundation for layouts mild or wild.
True to their promise, the authors deliver reality in section III, "The Real World." Chapter 9, "Cross-Browser CSS", gives the lowdown on that bane of style-lovers, Netscape 4. We're provided solutions to common layout problems, and common content-related problems. At over 30 pages, this is one of the longest chapters in the book, and rightly so; it's the practical application so many newbies fear. Followed by chapter 10, "Troubleshooting", this section prepares both the neophyte and the mature user to succeed in their stylistic endeavours.
The final section contains three projects, "The Gallery", "The Personal Log", and "The Online Store" which give increasingly complex real-world examples of style sheets in action.
"Cascading Style Sheets: Separating Content from Presentation" is not the ultimate CSS reference. It is, instead, an easily readable, fairly complete, and extremely practical discussion of the concepts and practices which will have you styling your web documents quickly — and correctly. Of special interest to evolters is the fact that three of our own served as technical editors: Mark Howells, Shirley Kaiser, and Adrian 'aardvark' Roselli. Shirley's comments at her weblog "BrainstormsAndRaves" make it clear that she also considers this a good read.
More information is available from the publisher at glasshaus.com.