Slashdot Log In
CSS: The Missing Manual
Posted by
samzenpus
on Wed Sep 06, 2006 02:59 PM
from the lost-and-found dept.
from the lost-and-found dept.
Michael J. Ross writes "Ever since Cascading Style Sheets (CSS) first appeared on the Web scene in the late 1990s, a plethora of books have been written and published that purport to explain how CSS works, and how to make it work for you. So why would any publisher decide that what the technical world needs is yet another CSS book? Perhaps because they have taken a close look at the bulk of those available titles, and found them to be wanting — filled with overly theoretical explanations and sample code that is far too focused on some pet domain of the author. Such books may be adequate for the veteran Web developer, who has the time and inclination to separate the wheat from the chaff. But developers new to CSS need much more approachable material, with clear examples. Perhaps that is the thinking behind CSS: The Missing Manual." Read the rest of Michael's review.
| CSS: The Missing Manual | |
| author | David Sawyer McFarland |
| pages | 494 |
| publisher | O'Reilly Media |
| rating | 7 |
| reviewer | Michael J. Ross |
| ISBN | 0596526873 |
| summary | An accessible guide to using CSS with HTML. |
Written by David Sawyer McFarland, CSS: The Missing Manual is published by O'Reilly Media, as part of their Pogue Press series, under the ISBN 0596526873. It first came out in August of 2006. The publisher maintains a Web page for the book, where visitors can find a link to register their copy of the book (does anyone do that?), a page for submitting errata (none yet, as of this writing), a form for posting a review on the O'Reilly site (again, be the first!), and a sample chapter (Chapter 1: Rethinking HTML for CSS) as a PDF file. There are also links for purchasing the book in the U.S. or the UK, and for reading the online version, as a part of O'Reilly's Safari service.
The book's 494 pages are organized into 14 chapters and three appendices, grouped into five parts. In addition, there is an index, as well as a terse but meaty introduction, which even includes a summary of HTML. The humor for which the Missing Manual books are known, begins early, in introduction, though in this case probably not intentionally: Page 9 claims that the book "is divided into four parts," and then lists the five parts. Before commenting upon those five-ish four parts, it should be noted that the table of contents runs seven pages, listing the book's parts, chapters, sections, and subsections. Future editions of the book would benefit from an overview table of contents, similar to those used in an increasing number of technical books, to good effect.
The 14 chapters cover most if not all of the essentials: writing HTML for CSS; creating styles and style sheets; determining what to style; using inheritance; using cascading; formatting text; setting margins, padding, and borders; styling graphics; styling links and navigation bars; styling tables and forms; creating float-based layouts; positioning page elements; creating print stylesheets; and writing maintainable CSS code. The three appendices include a CSS property reference, a discussion of CSS use in Dreamweaver version 8, and a listing of CSS resources to supplement the book.
On the positive side of the ledger, the author does a commendable job of clearly explaining all of the essential topics that the typical developer would need to understand in order to begin developing a robust Web site based on HTML and CSS, or reworking an existing site that is in desperate need of an overhaul. The clear explanations and bite-sized examples demonstrate that David Sawyer McFarland is not only an experienced Web developer, but likely has spent considerable time explaining to others how to do the same — as a writer, trainer, and instructor. This book is not his first, for he has previously written Dreamweaver: The Missing Manual.
One valuable aspect of the book under review, is that McFarland discusses how to overcome the most commonly encountered browser problems, in which Web pages employing CSS are not being formatted as one would expect and as specified in the CSS standards, by misbehaving browsers (that means you, "Internet Exploder"). Moreover, the book is also one of the first to document the significantly enhanced, long overdue, and welcomed CSS support in version 7 of the most commonly used Web browser (yes, we're still looking at you, "Browser by Bill").
The book is one in a series of many so-called Missing Manuals, whose tagline is "The books that should have been in the box," and whose Web site characterizes them as "Warm, witty, and jargon-free, [with] enough clarity for the novice, and enough depth and detail for the power user." In many respects, McFarland's latest contribution matches that description. In addition to the straightforward and yet comprehensive discussions of each topic, the author imbues his writing with a bit of humor, without overdoing it, or trying too hard, as is sometimes seen in other books covering subjects that admittedly can be quite dry.
On the negative side of the ledger, someone — or, more likely, some committee — somewhere along the decision chain, stipulated that almost every page of the book should be formatted so that the outside 1.5 inches, which is the easiest for a reader to see, should be consumed by a mostly empty and useless gutter, the bulk of which is filled with a light gray bar. This pushes the text, which slightly more than 4.5 inches wide, further in, toward the book's binding, and thus more difficult to read. This is true even though O'Reilly has wisely chosen to use RepKover, a flexible lay-flat binding. This exasperating style of layout is not characteristic of O'Reilly's books, which are generally much easier to read, with more sensible margins and often larger font.
One of the first principles taught to those learning Web design, is to avoid using white text on a black background. Such Web pages usually try to appear cool and edgy, but instead often comes off as immature in the eyes of an Internet veteran, and sinister to the Internet newbie. It doesn't work on Web sites, and it doesn't work in Web books. Sadly, O'Reilly chose to use white-on-dark-gray for many of the book's sidebars, making them difficult to read, especially as the sidebar text font size appears to be a bit smaller than that of the regular text.
In a nutshell, the content of this book is excellent, while the presentation of that content leaves much to be desired — ironic for a book focusing on CSS, whose primary purpose is to modularize and simplify presentation, neatly separating it from content. Ranking the content and presentation on a scale of 1 to 10, I would give them 9 and 5, respectively. Yet on balance, just as is true for most Web pages, the content is more important than its layout and other aesthetic considerations. CSS: The Missing Manual is a well-written, lighthearted, up-to-date, and easily accessible guide to modern CSS and how to use it in the real world.
You can purchase CSS: The Missing Manual 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.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Now if only (Score:5, Insightful)
Re:Now if only (Score:5, Funny)
That's what's so beautiful about standards. There are so many implementations to choose from!
Re:Now if only (Score:5, Insightful)
The problem is the browsers like IE that either only partially implement features or (as is most often the case of problems with IE) implement them in a way that goes against the standard. Then you have to either start throwing in cross-browser hacks, browser specific stylesheets, or change your page design.
I will occassionally get in complaints at our webmaster account about how something doesn't render correctly in a certain browser. My reply usually includes some boilerplate about how our site is coded to support a standard, and not specific browsers. If the browser supports the standard correctly, you've got no problems. If the browser is like lynx and doesn't support CSS at all, again no problem and the pages are semantic XHTML so we make thorough use of heading tags and similar 'built-in' context indicators. If you use a browser that doesn't implement the standard correctly, on your head so be it!
Re:Now if only (Score:4, Informative)
Because inline-block isn't supposed to be there. Not yet. The inline-block property was a proprietary Internet Explorer property. It has been added to CSS 2.1, but that specification is not yet finished - it's a working draft. So far, no finished W3C specification includes inline-block, it's still a non-standard Microsoft extension.
I Use Google (Score:2)
(http://twoturtlelovers.blogspot.com/ | Last Journal: Friday May 25, @03:01PM)
Granted, I probably learned all of this in CS101, but if I need to remember how to do something, I typically perform a google search instead of paging thru a "missing manual". But, for those that prefer paper, this looks good.
Keep in mind... (Score:5, Insightful)
Re:Keep in mind... (Score:4, Insightful)
(http://slashdot.org/)
It requires knowledge. Knowledge is not necessarily achieved by reading manuals cover-to-cover.
My knowledge is almost entirely obtained from experience, trial and error, and reading random web tutorials, articles and sources.
Ahh (Score:5, Funny)
Now that is has been found, they can get back to work.
Damn (Score:5, Funny)
(http://www.winckle.co.uk/)
The best CSS manual (Score:2, Informative)
http://www.w3.org/TR/REC-CSS2/ [w3.org]
Welcome to my hell. (Score:5, Informative)
(http://slashdot.org/)
CSS is a great idea, but doing it in practice blows because the browsers vary so much in their implementation.
The most useful thing I have found to help is QuirksMode Browser Compatability Tests [quirksmode.org]. I think this guy is insane to have spent so much time testing every single feature in (nearly) every browser, but it is very, very useful to see exactly which browsers support what.
Re:Welcome to my hell. (Score:5, Insightful)
Re:Welcome to my hell. (Score:4, Informative)
I personally don't think pain is going to bring about change.
But you'll never know because you will bend to MS's lock-in strategy.
The actual functionality isn't an issue across browsers, but yeah the apps I make break in FF, Opera and Safari.
Umm, then yeah it's an issue.
That said we can't afford to not cater to IE users. They make up over 95% of clients.
You must have an unusual site then. Most sites and statistical studies show all versions of IE combined at about 80% of Website hits. As for affording to not cater to them, it all depends upon how you market it to customers and the type of site you run. A simple, "This Web page uses advanced Web 1.5 features from the 1998 standards. Your current browser is out of date and may be insecure. Click here to upgrade if you want to view all formatting properly." might be viewed as a feature, rather than a nuisance, especially if a coalition of major sites decided to do it all at once, so they would no longer have to pay double the development costs to reach the whole market.
I haven't yet heard a complaint or seen some feedback come through our form stating "omg I gotta use IE!!!"
Really do you track that? I know I used to complain when any company I did business with tried to make me use IE only, although now there are more options for everything so I normally just assume they are incompetent and probably clueless. Given that, I don't want to trust any data to them, so I just go elsewhere. Try monitoring the number of hits you get using alternative browsers, which then don't hit again with IE from the same IP address. It is not hard with some basic statistical trackers that you can grab for free. You might be surprised how much business you're losing. The other issue is, alternative browsers often represent the more affluent parts of society. Apple laptops accounted for 20% of laptop sales last month and almost all of them will be using Safari. How many of those people are the ones with lots of disposable income? As I said before, it all depends upon what type of sites you make.
Personally, I'm very happy I no longer have to bother working around all of IE's failures. It has cut my workload down to less than half of what it was. I just wish everyone could have the same easy development I do, without having to worry about anything but clearly documented standards.
Hell can be bearable... (Score:4, Insightful)
Must be nice to not have to maintain public-facing pages for a large company
Yes, it is quite nice not have to maintain such a site, since most "public-facing pages for a large company" are notoriously and unnecessarily complicated and standards-broken. Furthermore, it is false to say that these sites are broken becasue they must cater to IE. It is in fact the other way around--IE is broken because of the incompetence or (false) laziness, impatience and hubris of the designers and maintainers of these big public sites. MS is to blame for applying sinister "embrace and extend" strategies to its product, however by far the primary responsibility for the current messy state of affairs lies squarely with the codemonkeys who vomit forth the tag soup that all too often continues to pass for web pages today.
Let me explain: when then-leading Netscape introduced nonstandard extensions to HTML, or incorrectly or poorly implemented the standard, rather than report it as a bug web authors actually EMBRACED these quirks rather than working around them or otherwise ignoring them. For example, early web developers heavily abused non-semantic and sometimes annoying proprietary tags like CENTER and BLINK, and went as far as to do atrocious things like nest their content in multiple BODY tags with different BGCOLOR attributes to do useless crap like fading and flashing the screen. The result of this was to not only let Netscape neglect bugs, put to put pressure on Netscape to RETAIN the bugs so as to remain "compatible" with such perverse tag soup!
The phenomenon proved to be viral--in the interests of matching leader Netscape's "feature" set, Microsoft went ahead and emulated all that malarky on purpose in IE! Furthermore, MS realised that nonstandard extensions were rather easily embraced by stupid lazy tag soup codemonkeys. This was a great opportunity to embrace and extend the WWW with such atrocities as ActiveX OBJECTs and heavy promotion of CSS-like styles long before the CSS standard was established. The latter action was particularly incideous because it allows MS to say that they "support standards" when in fact they sabotage them. Rather than warning web authors to use caution with stylesheets until the CSS style was standardised, they went ahead and made sure it was getting well established so that when changes were made to their proposal for CSS was modified by the W3C. By doing that they ensured that their own inconsistent application of CSS would be the de-facto standard and they could let slide any fixes to *actually* follow standards.
So please, make your best effort to break this evil cycle and do NOT design for IE. This doesn't mean that you should let your site break IE or make it look crappy--what it means is do NOT use IE during development without regard to standards then worry about degrading gracefully in other browsers. Instead use FF or another more compliant browser during development, and regularly validating your code using the W3C validation tools. THEN, when you test against IE (this is the real world, so you can't ignore it as the grandparent post implies) you make sure it degrades GRACEFULLY in IE, and do it WITHOUT relying on sneaky CSS bugs and breaking standards.
Yes, you CAN write totally valid XHTML and CSS that looks attractive and retains enough functionality in IE to satisfy your audience. Here are some approaches I have taken in the past:
* Avoid the use of CSS features that are standards but not widely implemented in IE or other mainline browsers, at least for important presentational aspects (anything more than eye candy).
* Do NOT strive to make the page appear or function fully and exactly the same in IE as other browsers--just make sure it doesn't look "broken" in IE. MS has deliberately "dumbed down" their pages for non-IS browsers in the past (even when other browsers were perfectly capable of handling the page as designed for IE). Given
Re:Welcome to my hell. (Score:4, Insightful)
(http://marshallbrain.com/manna1.htm)
Re:Welcome to my hell. (Score:5, Interesting)
(http://www.keiretsumusic.com/steve/ | Last Journal: Saturday February 17 2007, @05:51PM)
I follow the standards and still have it looking decent in IE. I never use "IE hacks" (as in deliberately malformed statements or comments), and I never use browser detection (both are basically a bit retarded imho) -- but I can still get the pages to look OK in IE, served exactly the same (validated) CSS.
There are just a few caveats:
- Be prepared to abandon hope of absolute pixel-level control over everything. Seriously, if you want that, go into print design, that's not how the web works.
- (Sometimes this one works as an OR to the above point...) Fix the box model by adding an extra non-semantic div. Simple as that. Voila, no more broken box model, but no invalid CSS full of Tantek hacks [tantek.com] either. I don't know why more webdesigners are so against this. Banging on about favouring standards, yet they'd rather deliberately break (invalidate) their own CSS than add a single non-semantic wrapper div? I never quite grasped that. The broken IE box model is responsible for the vast majority of places where pixel-accurate control breaks down between IE and, well, the rest. Of course, it doesn't help fix your 3-pixel jog [positioniseverything.net] (for example), but it certainly cuts out the biggest offenders.
- Be prepared to lose a few bells and whistles - for example, no
:hover pseudoclass on arbitrary elements. So you can't have table cells that change color as you mouseover. This is pure candy though, so I'm prepared to "not support" IE in this regard. The overall layout/style is exactly the same, so it's not like I'm making IE degrade to "plain, unformatted hypertext" as you suggest - just they miss a few tiny "cherry on top" effects.
- (Again this is a bit of an OR to the previous point) - use javascript. For example, get the effect of arbitrary
:hover by using suckerfish [htmldog.com] javascript techniques.
And before anybody asks, yes, I do maintain public-facing web pages for a large organisation.Admittedly our main website is horrible non-standards HTML4 with patchy use of hack-filled CSS, but I didnt design it, and I can't fix it because even when I enter valid markup, our lousy CMS (built firmly on the MS stack with the MS toolchain, just to feed your prejudices) will bodge it up for me. Grrr.
But the new microsites I design are 100% standards compliant and they look 99% the same in IE or Moz/etc. My management wouldn't have it any other way.
Grumble... (Score:1)
(http://127.0.0.42/)
And way too many half-baked blogs out there on both subjects as well.
Where are all the Really Good(tm) books and sites?
Mumblefuhtz...
missing rule!? (Score:2)
(http://easyvpshost.com/ | Last Journal: Friday August 26 2005, @06:58PM)
Amazon has it cheaper (Score:5, Informative)
(http://www.ensode.net/ | Last Journal: Wednesday August 10 2005, @09:18PM)
Too late. (Score:1)
What's Missing? (Score:1)
ObMontyPython (Score:1)
"And the number of its parts shall be five!"
"Four, sir."
"Four!"
Not another CSS book! (Score:1, Flamebait)
man css (Score:2)
(http://cpgblogger.blogspot.com/)
No manual entry for css
Hmmm, guess they were right.
I don't understand (Score:2)
Comma Chameleon (Score:2, Informative)
(http://greyduck.net/)
Speaking of "more difficult to read," while I'm as big a fan of using commas as the next talentless hack, maybe this review could've done without roughly half of the little buggers that are sprinkled throughout.
Who needs a book? (Score:1)
(Last Journal: Tuesday June 19, @07:48AM)
The specs are all on-line [w3.org].
OK, I'm joking, but it would be nice, wouldn't it?
Immature and sinister are not always bad things! (I feel I have to stand up for my white on black site, even though I'll just get flamed again).
CSS Zen Garden (Score:3, Informative)
However for some inspiration about what CSS can do for you a trip to the CSS Zen Garden at http://www.csszengarden.com/ [csszengarden.com] is worth a thousand pages of dry css scripts. The recently published book 'the Zen of CSS design' is also excellent - http://www.amazon.com/Zen-CSS-Design-Enlightenmen
My internet... (Score:2)
(http://www.paulmischler.com/)
My internet didn't come in a box... it came in a tube!
Chapter 13:Displaying tabular data without "table" (Score:5, Funny)
Not available online yet.. (Score:2)
(http://erlando.dk/)
CSS question (Score:2)
(Last Journal: Monday August 16 2004, @09:50AM)
I have 3 divs. A main div which encloses the other 2. One is floated to the left, one to the right.
If i don't set a height on the container div, on firefox the divs will grow out of the bottom border of the div, but on IE6 the container grows automatically. OK, i just set overflow:auto to the container div and both browsers work fine.
But, if i put content to the left div, and use the right div for images and such, the right div wont grow to match the left div's size.
Is there a way to do this? Besides faking it by using the same background color and such...
Note: example code is over at Google Groups [google.com]
title (Score:2)
(http://www.atomjax.com/)
So then this isn't the "missing" manual, it's a "new and improved" manual.
CSS Cookbook is also a great resource... (Score:1)
(http://webstandards.raquedan.com/)
...for CSS and web standards. It's really for the practical developer. You can check out my review of the book here [raquedan.com].
Hope that helps.
Browser Selector JS (Score:1)
(http://www.ericdfields.com/)
IMHO, not enough web developers know about the these lovely 832 bytes of JavaScript that make my life 20x easier:
http://rafael.adm.br/css_browser_selector/ [rafael.adm.br]
Need to adjust a width for IE only but don't want to completely redo all the CSS you've done so far? .ie #wrap becomes an IE-only selector. It's flawless thus far...
I don't recommend becoming too dependent on this kind of trickery. I first do valid mark-up, then apply CSS, debug across browsers, _then_ if something just absolutely won't work well in browser X and it's not worth the time to retrace my steps, I throw in this javascript, make my selector, and move on. Nice and future-proof too: when IE7 comes out and fixes issue Y, just knock out the selector from the CSS and get on with your life.
First we Invented WYSIWYG, now we use CSS (Score:1)
(http://waxinglucid.blogspot.com/)
A better book on CSS differs little from a great manual on how to hand-crank a Model T Ford. WYSIWYG [wikipedia.org] was invented in the 1970's. Layout using Wysiwyg tools has its problems, but CSS seems to solve none of them. (Maybe one, but I don't know which one).
The tragedy is that I really need a better book on CSS.
Hand-coded CSS seems to be hanging on mainly because people still need to hand-code HTML, even though that should be WYSIWYG too. And hand-coded HTML seems to be hanging on mainly because of mixin-languages like PHP which enable database integration. Word processors usually don't need database integration. Note that Microsoft went to great lengths to allow people to embed live spreadsheets into Word docs, a feature that has been widely ignored. Still, it's past time for web design to leave explicit hand-coding behind. Or else what's all this Computer Science for?
Other books (Score:1)
(http://www.baldock-web-development.com/)
concerning the book design (Score:1)
On the negative side of the ledger, someone -- or, more likely, some committee -- somewhere along the decision chain, stipulated that almost every page of the book should be formatted so that the outside 1.5 inches, which is the easiest for a reader to see, should be consumed by a mostly empty and useless gutter, the bulk of which is filled with a light gray bar.
I sez:
I can't judge the design not having seen it with my own eyes, and cannot speak to the light grey bar at all, but the wide outer margin is a common design when one might be expected to make notes in the margin.
I know, I sort of trained myself never to write in books and I'm sure that is a practice many reading this follow. But the other night, I had a question about something I was reading, and I had no other paper around, so I made a note about the text in context over to the side.
Often, the bare outer design is often used by the authors themselves for illustrations and side bars. And a bar of color along the side is often used like a thumb index to delineate chapters. There are purposes for design elements, including negative space, towards a books outer margins.
Book publishing layout (Score:2)
(http://www.kabong.ca/)
"I have a truly marvelous stylesheet that solves all of IE's CSS problems, alas which this margin is too narrow to contain.
Re:CSS FTW (Score:2)
(Last Journal: Monday December 04 2006, @04:08PM)
They could make a huge leap forward on this front by making one small change: Turning on the "standards compliant"* mode by DEFAULT!
*I use this term in the loosest possible sense
Re:CSS FTW (Score:2)
(http://www.gogo.co.nz/)
The sad thing is, that even if it does, the take up of IE7 is going to be so slow that IMHO, I expect well over 50% of IE users to still be using IE 6 or lower for years. Even with all the security problems, people continue to use very old versions of IE - because they simply don't care, thier "Internet" works, so why should they change it.
In short, IE 7 getting better support for CSS isn't going to make life any easier for web developers, it's not going to mean we can remove annoyances to work around IE 6 and lower, in fact it's probably just going to create more work, because it's yet another version of IE that we need to test websites in, lord knows there will be new bugs.