Forgot your password?
typodupeerror
Book Reviews Books Media

CSS: The Definitive Guide 160

Posted by samzenpus
from the all-you-need-to-know dept.
Michael J. Ross writes "Every Web developer knows that Cascading Style Sheets (CSS) makes it possible to separate the contents of Web pages from the styling of the elements on those pages. This in turn confers tremendous advantages, such as allowing site-wide changes of appearance to be made just once, in a single stylesheet file, rather than in all of the pages containing the affected elements. The syntax and proper usage of CSS is not as simple as implied by many HTML/CSS books, most of which fail to provide enough detail as to how CSS is applied to page elements. Web developers relying upon these books soon find themselves hitting those limits, and becoming frustrated when trying to debug Web pages. CSS: The Definitive Guide, authored by CSS expert Eric A. Meyer, aims to fill that gap." Read on for the rest of Michael's review.
CSS: The Definitive Guide
author Eric A. Meyer
pages 536
publisher O'Reilly Media
rating 9
reviewer Michael J. Ross
ISBN 0596527330
summary A comprehensive CSS reference guide.


Published by O'Reilly Media in November 2006, this title is now in its third edition. The first edition appeared in May 2000, and the second in January 2004 — with each one establishing the book as an immediate favorite among hard-core Web programmers. Each revision brought it up to date with the evolution of CSS as a standard, its support among the most popular Web browsers, and its usage within the Web development community. This latest edition covers CSS2 and CSS2.1, but does not include the CSS3 modules, including those that have reached Candidate Recommendation status, because their implementation is largely incomplete among most of the browsers.

Web veteran Eric Meyer presents the book's material in a methodical manner, starting with an overview of CSS's purpose and advantages, and quickly moving into the details of the technology: selectors, structure, inheritance, values, units, fonts, text properties, visual formatting, padding, borders, margins, colors, backgrounds, floating, positioning, tables, lists, and generated content (e.g., bullets of unordered lists). The last two chapters address user interface styles (system fonts and colors, cursors, and outlines) and non-screen media (such as paged and aural content). The book's 536 pages are organized into a total of 14 chapters and three appendices. The first appendix is a complete CSS property reference, spanning more than 40 pages, with visual, page, and aural properties grouped separately. For each property, Meyer explains its purpose, its valid values, the initial value, what elements it applies to, whether it is inherited, its computed value, and additional notes (if any). The second appendix is a reference for the selectors, pseudo classes, and pseudo elements. The third and final appendix is much shorter than the first two, but no less interesting, as it discusses a sample HTML 4 stylesheet, which is presented in the CSS2.1 specification as the recommended style sheet for developers to use.

As with all of their other titles, O'Reilly Media offers a Web page devoted to this book, where visitors will find links to online versions of the book cover, table of contents, index, registration form, reader reviews, and errata (of which there are none, as of this writing). In addition, the page has offers to receive a volume discount, and to read the book online as part of O'Reilly's Safari service.

Anyone who is considering purchasing this book might initially be concerned by the dearth of feedback on the Web sites of the publisher and the major online booksellers — in the form of few reader comments, and no reported errata. The prospective reader may wrongly conclude that this indicates a lack of interest in the book, and thus it must be unpopular — probably for good reason. But just the opposite is true, as demonstrated by the book's sales rank on Amazon.com alone: #4631, as of this writing. Unlike far too many of the other HTML/CSS books available, this one does not engender scathing reviews by customers angry with the books' shoddy writing and sloppy mistakes. Rather, Meyer's contribution is the type of solid reference book that the discerning Web developer will quietly place on their desk or bookshelf, within easy and frequent reach — possibly displacing a dog-eared first or second edition of the same title. Furthermore, the absence of errata should suggest that most if not all kinks have been worked out of the book, and not that the book is failing to receive careful readings.

CSS: The Definitive Guide benefits not just from its multiple revisions, but also from Eric Meyer's clear and complete writing style. Unlike his more advanced books, this one is far more approachable, making it possible for the reader to easily jump into the midst of any topic and quickly pick up the thread — as is essential for any technical reference work. The theoretical discussions and the sample code demonstrate his abundant experience in using CSS in the real world, discovering or verifying its idiosyncrasies, and pushing it to its limits. Most of the critical visual and positioning topics are well illustrated with diagrams and sample output, few of which are weakened by the lack of color in the grayscale figures. Last and certainly not least, readers should be pleased that the book's material has been updated for Internet Explorer 7, which promises to fix many inexcusable problems in earlier versions of the browser.

Rarely does one come across a programming book that has no significant flaws, and will likely become a favorite resource for developers everywhere. CSS: The Definitive Guide is a comprehensive, well-written, and welcome addition to the library of any Web developer who wishes to understand and utilize CSS better.

Michael J. Ross is a Web consultant, freelance writer, and the editor of PristinePlanet.com's free newsletter. He can be reached at www.ross.ws, hosted by SiteGround.


You can purchase CSS: The Definitive Guide from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
This discussion has been archived. No new comments can be posted.

CSS: The Definitive Guide

Comments Filter:
  • My experience (Score:4, Informative)

    by 2.7182 (819680) on Monday January 29, 2007 @04:08PM (#17804054)
    This is a great book, but my binding cracked after 2 weeks. Worth buying anyway though.
  • by Anonymous Coward on Monday January 29, 2007 @04:10PM (#17804090)
    If you examine the link in the parent's post, it shows that he's using a referral code, kaleidojewel1-20. Scumbag.
  • by popo (107611) on Monday January 29, 2007 @04:16PM (#17804170) Homepage

    The book is, as the OP states, excellent.

    The problem lies with its index. Actually using the book is very difficult because the Index is so non-inclusive of the subjects within the book.

    Worth getting, but be prepared to flip through it a whole lot more than you would if the Index was well written.

    My 2 cents.

  • by juiceCake (772608) on Monday January 29, 2007 @04:47PM (#17804546)
    I find that making sure you use a strict XHTML doctype definition, IE behaves remarkably well. I can do all my layout and text styles in CSS and use the !important hack occasionally in style sheets rather than use conditional statements. Of course I can't use attribute selectors and so forth, but one day, one day...

    There is, of course, some compromise, but it sure beats developing with tables, which is just a mess.
  • by 8-bitDesigner (980672) on Monday January 29, 2007 @04:55PM (#17804664) Homepage

    Hey, don't knock conditional comments. While I'm all for semantics, the ability to target IE7 and IE6 and serve them their own stylesheet is immensely useful when you're handling things like IE6's penchant for doubling the margin on floated elements.

    And yes, while it isn't a perfect solution, I'm just one find/replace away from tossing the IE6 stylesheet the minute its market share drops low enough.

  • Re:My question (Score:5, Informative)

    by itlurksbeneath (952654) on Monday January 29, 2007 @04:57PM (#17804686) Journal

    Css browser support [webdevout.net]. Pretty good guide. If you design for FF or Opera and don't use any hairy CSS, it should look pretty good in IE7 (assuming you're using a decent DOCTYPE) and can be tamed in IE6 with a few tweaks to fix things like the broken box model and such.

    Interesting thing I noticed when scrolling through the guide linked above - the level of css support between IE6 and IE7 isn't all that different (maybe a handful of new items supported). So, IE7 was mainly a bugfix release. Five years and they finally fixed the CSS engine. Way to go MS.

    If you can't see the sarcasm dripping from above, check your glasses.

  • Re:My question (Score:3, Informative)

    by Fozzyuw (950608) on Monday January 29, 2007 @05:05PM (#17804808)

    it has been updated to account for IE7's ideosyncracies, but does it also cover the other browsers well?

    Good question, each browser has different levels of support. If you check out some browser usage [w3schools.com] you can see a decent estimate of what browsers are most used. Then you can check out browser CSS compatibility [quirksmode.org].

    Besides IE6 (I'm not supporting IE5 Mac), I do not see issues across (modern or heavily used) browsers very often, unless I'm trying to do some sophisticated, multi-column, nested, floating DIV design. Also, in my experience, complicated float designs usually can be simplified with other means to avoid X-browser issues.

    The biggest problem with CSS is that it also required good (X)HTML markup. Sometimes your CSS is sound, but the HTML code is not proper or designed by design instead of designed by content. A good book on working through this is Transcending CSS: The Fine Art of Web Design [amazon.com] whose authors are also well known in the CSS/Website world and quote from Eric Meyer (the author of the book being reviewed on this page) as well as others.

    I've been starting to learn that lots of my CSS frustrations of the past have mostly been part of my fault not thinking about CSS properly and trying to make easy things more complicated. Though, it can still be said, there's still lots of room for improvement, in both browsers and CSS specs.

    Cheers,
    Fozzy

  • by Anonymous Coward on Monday January 29, 2007 @05:10PM (#17804840)

    I find that making sure you use a strict XHTML doctype definition, IE behaves remarkably well.

    XHTML is not appropriate [hixie.ch] on Internet Explorer. I use XHTML 1.0 Strict on my site, but I also know that the vast majority of my regular visitors are using Firefox. I'd certainly never suggest using XHTML to make things easier on IE. You can get the same advantages, and avoid the complications, if you just use semantic-meaningful HTML 4.01 and CSS, making sure each validate.

  • by brunascle (994197) on Monday January 29, 2007 @05:35PM (#17805168)
    i find XHTML is fine as long as you develop using the application/xhtml+xml content type, then switch to text/html for production. and obviously you'll have to develop using a broswer that supports XHTML (not ie).

    that, or have your site change the content-type in a script, depending on what the browser sent in the Accept header.

    if you're not using application/xhtml+xml in development, you might as well stop using XHTML all together, because chances are there are errors all over the place.
  • by koehn (575405) * on Monday January 29, 2007 @06:46PM (#17806092)
    To everybody posting the obligatory "IE Sucks at CSS", while I agree with the sentiment, my own IE experiences got much less painful (and this goes for Firefox too) when I learned how the browsers tell between "quirks mode" (where rendering with CSS is a true crapshoot) and "standards compliance mode" (where rendering with CSS is... somewhat less of a crapshoot).

    If your DOCTYPE tag at the start of your HTML starts with something like:
    [!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
                            "http://www.w3.org/TR/html4/strict.dtd"] (in angle brackets, thanks Slashdot!)

    Then IE/FF will render it in a fairly similar way. If you don't include the URI of the DOCTYPE ("http://www.w3.org/TR/html4/strict.dtd", above) then you're stuck in quirks mode hell.

    That said, IE still sucks at CSS.
  • by RoseAlbert (972627) on Monday January 29, 2007 @06:58PM (#17806318)
    I have always had success with the example code explained on A List Aparat's Article "In Search of the Holy Grail" by Matthew Levine http://alistapart.com/articles/holygrail [alistapart.com]
  • by Isofarro (193427) on Tuesday January 30, 2007 @03:08AM (#17810726) Homepage

    There are elements of CSS that are quite functional and workable, but for the most part its just a cludge and a bad one at that. Lets take for example something that could make all of our lives easier, the basic ability to have include files. All you CSS lovers hate frames and you hate tables. Well with frames I can make ONE file contain the entire drop down menu section. I create it in one file and ONLY one file. I edit it in ONE file and ONE file only.

    CSS isn't a content language, its a styling language. A styling language that relies on the underlying semantics of the markup language you are using.

    Your problem has been solved over a decade ago:

    Of course, using SSI means using a webserver and configuring it properly. Even decent shared hosting gets that right. Might not work on Geocities though, but HTML preprocessing will.

If a camel is a horse designed by a committee, then a consensus forecast is a camel's behind. -- Edgar R. Fiedler

Working...