Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

CSS: The Definitive Guide

samzenpus posted more than 7 years ago | from the all-you-need-to-know dept.

Book Reviews 160

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.

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.

cancel ×
This is a preview of your comment

No Comment Title Entered

Anonymous Coward 1 minute ago

No Comment Entered


Save $6.30 by buying the book at Amazon.com! (-1)

Anonymous Coward | more than 7 years ago | (#17804032)

Barnes and Noble is selling this book for $35.99, but Amazon.com is only selling it for $29.69!

Save yourself $6.30 by buying the book here: CSS: The Definitive Guide [amazon.com].

MOD PARENT DOWN. Referral spammer (1, Informative)

Anonymous Coward | more than 7 years ago | (#17804090)

If you examine the link in the parent's post, it shows that he's using a referral code, kaleidojewel1-20. Scumbag.

Mod parent down. (0)

Anonymous Coward | more than 7 years ago | (#17804222)

Since the last guy got modded down, I'll repeat it: The parent is referral spamming.

For those who don't know about referral spamming (0)

Anonymous Coward | more than 7 years ago | (#17804302)

Could someone explain exactly what this is ? Sorry I am not up to date on this sort of thing.

Re:For those who don't know about referral spammin (1)

EugeneK (50783) | more than 7 years ago | (#17804464)

he gets some tiny percent of a cent if you click on the link. a big chance for idiots to waste time piling on him for trying to make an honest .0000001.

Re:For those who don't know about referral spammin (0)

Anonymous Coward | more than 7 years ago | (#17804588)

Actually, the referral payment for this guy would be about $1.92 for each book sold. You can make good money referral spamming on Slashdot. Back when I was unemployed and had a lot of time on my hands to surf the 'net, I was getting about $100/week, which isn't bad at all. Still, it's easier to make an honest living if you can.

Re:For those who don't know about referral spammin (1)

EugeneK (50783) | more than 7 years ago | (#17805566)

hm, didn't know it was that much. still, i don't call it spam because

1. it is on topic (ie how to get the book that this article is about)
2. it is legitimate (ie you truly can get the book at the stated price)

if you can somehow make $100 a week doing that, more power to you.

On the other hand, if 50 people started doing it for every book review..it might become a problem.

Re:For those who don't know about referral spammin (1)

larry bagina (561269) | more than 7 years ago | (#17806906)

point 3: the referral doesn't affect the price.

If I buy the book through that link, I'll save $6.30. How is that bad? The fact that someone else makes a some money in the process doesn't adversely affect me (in fact it save me money).

My experience (3, Informative)

2.7182 (819680) | more than 7 years ago | (#17804054)

This is a great book, but my binding cracked after 2 weeks. Worth buying anyway though.

Re:My experience (5, Funny)

Rob T Firefly (844560) | more than 7 years ago | (#17804186)

This is a great book, but my binding cracked after 2 weeks.
This is why I prefer hardbound CSS books, where you can make changes to the book's binding independently of its content.

Re:My experience (1)

Azarael (896715) | more than 7 years ago | (#17804346)

For the softcover books that you do end up getting a lot of use out of, some bookstores offer rebinding. Might be a little pricey, but may be better than having a reference that's in 3 or 4 pieces.

Re:My experience (1)

CRCulver (715279) | more than 7 years ago | (#17804254)

This is a great book, but my binding cracked after 2 weeks. Worth buying anyway though.

Your binding cracked. How was it bound? I don't buy too many books from O'Reilly recently, but the last one I bought, Python in a Nutshell [amazon.com] uses a rather novel binding that allows the book to lay flat and is quite durable. I assumed all O'Reilly books would use this newer system. And even my oldest O'Reilly books from the mid-90s are still fine, no weaking of the glue in the traditional binding. Did you write to the publisher to complain? Often as a gesture of goodwill they will allow you to exchange the book if you write a paper letter written sweetly enough.

Re:My experience (0)

Anonymous Coward | more than 7 years ago | (#17805364)

Sssshhh. Your pesky facts will expose the fact that the poster used a shadow account to post the straight line, setting up his other account for the joke.

Re:My experience (1, Offtopic)

M00TP01NT (596278) | more than 7 years ago | (#17804842)

This is a great book, but my binding cracked after 2 weeks. Worth buying anyway though.
If it had been a Windows book, someone else would have cracked it for you (and it wouldn't have taken two weeks).

A wonderful book (4, Interesting)

SavedLinuXgeeK (769306) | more than 7 years ago | (#17804106)

I purchased the previous version, and it was truly a clear and concise introduction and mastery of CSS. Mastery in the sense of understanding how CSS works, not in mastery of CSS Cookbook type "fixes". It was much better to learn the fundamentals of CSS before trying to understand why and how the hacks work the way they do. I still keep and use the book as a reference at my desk at work.

designer not developer (0)

outsider007 (115534) | more than 7 years ago | (#17804154)

Why don't people understand the difference between a designer and a developer?

Re:designer not developer (4, Insightful)

drinkypoo (153816) | more than 7 years ago | (#17804252)

Why don't people understand the difference between a designer and a developer?

The web makes that distinction hazier and hazier. Many of us end up doing both in spite of the fact that we're not really suited to it, unfortunately. Of course, the software lets us get decent results easier and easier all the time, so that helps.

But even just talking about CSS, is doing CSS really just design? With all the stupid CSS tricks you have to play, it seems to me more like cross-platform programming than anything else.

I realize that CSS is not a programming language. More's the pity; if it were a little more like a language then a lot of things that are very hard to do in CSS and require dynamic styles (or at least assignation of styles) to do properly would be very easy. For example, I should be able to say that an element is n% minus the width of another element... But since I can't I have to figure out how many units (typ. pixels) are in n%, then figure out how many units wide the other element is, and then set the width of the element I was trying to size accordingly. And if the element I'm trying to fit in next to is sized in ems instead of px, I have to recalculate this data and resize elements every time the font size is changed.

Re:designer not developer (1)

CRCulver (715279) | more than 7 years ago | (#17804472)

Yes, I wish CSS had support for if statements. I maintain a website in several languages. Now, if a span with xml:lang="es" appears in an English, French, whatever paragraph, it should be italicized, but if a span inheriting xml:lang="es" appears in a Spanish paragraph, it should be styled the same way as the surrounding text. Unfortunately, there's no simple way to do that in CSS. I have to write dozens of individual rules for each language like body:lang(en) span:lang(es) { font-style: italic; } instead of just declaring "If a span appears with a different xml:lang attribute than surrounding text, italicize, otherwise not".

Re:designer not developer (1)

Peganthyrus (713645) | more than 7 years ago | (#17804976)

Have you tried italicizing all spans with a lang attribute, then de-italicizing english-in-english, spanish-in-spanish, french-in-french, etc?

span:lang {font-style:italic}

body:lang(en) span:lang(en),
body:lang(es) span:lang(es),
body:lang(fr) span:lang(fr),
body:lang(dk) span:lang(dk) {font-style:normal}

paint with broad strokes, then carve out the exceptions.

(and check the syntax; I've never styled arbitrary xml documents, just ordinary HTML.)

Re:designer not developer (1)

styrotech (136124) | more than 7 years ago | (#17805722)

Yes, I wish CSS had support for if statements.

Hell, I'd be happy with just named constants for colors and numbers (and maybe even for whole or partial selector expressions?).

And now that we're dreaming here I'd be extra happy with math expressions for numbers especially if they could reference properties from other elements. That is starting to get a little like duplicating the DOM scripting stuff though.

Re:designer not developer (2, Funny)

Doctor Memory (6336) | more than 7 years ago | (#17804474)

Why don't people understand the difference between a designer and a developer?
The web makes that distinction hazier and hazier.
Heh, not in my case. One look at my pages and people know right away I'm a developer...

Microsoft CSS thought about this... (1)

sheldon (2322) | more than 7 years ago | (#17805182)

Seriously, I saw this in a css file:

td.LockTopLeft {
/*IE5+ only*/
    left: expression(this.parentElement.parentElement.parent Element.parentElement.scrollLeft);
    top: expression(this.parentElement.parentElement.parent Element.parentElement.scrollTop-1);
My initial response was what the hell does that do? But it actually locks this table entry within a parent div tag.

It's basically like the behavior in Excel where you freeze the top columns or something like that. So it's not a bad behavior to have, but like you say the only way to do it is to know ahead of time where everything is. difficult with dynamically generated data.

and so Microsoft embedded like javascript language into their CSS. It's completely non-standard, not supported by anybody else. And I keep wondering when will we something like this in the standard?

Re:Microsoft CSS thought about this... (1)

brunascle (994197) | more than 7 years ago | (#17805384)

i had to do something like that once, where the left column and top row were frozen. i used javascript instead of CSS, though, and it worked in both IE and firefox.

for just the top row there is an easier way to do it, though, but IE doesnt support it: separate the header of the table using a thead and set it to position: static, i believe.

Re:designer not developer (1)

rainman_bc (735332) | more than 7 years ago | (#17806768)

But even just talking about CSS, is doing CSS really just design?

Especially with all the crappy designers out there who use Dreamweaver and really haven't a clue about CSS and could care less.

We're all stuck with .style1 {font: size 8pt; } .style2 {font: size 9pt; }
. .style39029 { font: size 10pt; }

Re:designer not developer (1)

juiceCake (772608) | more than 7 years ago | (#17807982)

Using Dreamweaver is not the problem. It's the designers, entirely. Many designers/developers, etc. use Dreamweaver and know all about CSS.

Re:designer not developer (0)

Anonymous Coward | more than 7 years ago | (#17804274)

Illuminate us. What is the difference, O outsider007?

Re:designer not developer (1)

BLACKtactx (1015407) | more than 7 years ago | (#17806602)

Being a developer and a designer, I think that an understanding of both facets of the website/blog/whatever process is important to know. I think with the advent of CSS, the boundaries have certainly blured,and as other posts have said, a developer stops at image manipulation, a designer stops at coding. It is probably beneficial for a designer to know the limitations of html and css, in order to not give the developer one hell of a headache. It is also beneficial (although less so) for a developer to have an inkling of good design flow. Hopefully at the end of it all you will end up with a site that is good looking and maneageable. If these two seemingly disparate job descriptions cant harmonize, then you end up with a dog slow site that looks wonderful, but is completely unusable, or you end up with a great functional site that nobody stays at longer than 1 second due to retinal burn. I think to be the most employable, you must know css and html. Most job descriptions I have seen unless for larger teams dont make any distinction, instead wanting a do it all guy or gal.

Re:designer not developer (1, Interesting)

Anonymous Coward | more than 7 years ago | (#17804314)

Believe me, working in a graphic design firm as a web developer, there is a large difference between a designer and a developer. Designers here work almost exclusively in Photoshop and only have to have the most rudimentary understanding of what can and can't be done using XHTML/CSS. I'd say that somebody who is used to looking at XHTML/CSS, coding from scratch, understands inheritance, and how these can be used to accurately reproduce major corporate websites across most any browsing environment qualifies as a developer.

Re:designer not developer (1)

Intron (870560) | more than 7 years ago | (#17805644)

Easy: A designer is the one that hands a developer a 30 MB background image, 16 1MB panels and 100 33K widgets and asks why it takes so long for the page to load.

Re:designer not developer (1)

zdislaw (664912) | more than 7 years ago | (#17807050)

A designer who has only a rudimentary understanding of what can and can't be done using XHTML/CSS is only a rudimentary Web designer.

Re:designer not developer (0)

Anonymous Coward | more than 7 years ago | (#17804896)

"Developer" is what it should be.

The designers I've worked with seem to know what you should do with CSS (whether they actually practice it or not).

The developers I've worked with often seem to be too fscking thick to understand why you shouldn't hard-code fonts and sizes into your programatically generated HTML. (and they suffer from the whole tabular layout thing too, but that's not really a CSS issue...)

Web developers need a book like this much more than do designers.

Re:designer not developer (2, Insightful)

telbij (465356) | more than 7 years ago | (#17805284)

Then your designers are better than your developers. A good developer should inherently understand the benefits of clean HTML, as well as the subtleties of what can be accomplished with CSS much better than a designer. Developers are always thinking in terms of code reuse and maintainability (at least if they're any good), whereas a designer is more concerned with how things look and maybe usability. The developer is the one who actually has to refactor HTML mockups from designers into templates, so (s)he is the one that should be concerned about bloated non-reusable HTML.

Good to hear that your design people know the benefits of CSS though.

Re:designer not developer (2, Insightful)

Bertie (87778) | more than 7 years ago | (#17804932)

My definition of a designer is that their role stops short of writing code, whether that's HTML, CSS, whatever. They don't concern themselves with how something's implemented, because then you find yourself thinking like an engineer, and working in terms of what's most expedient, rather than like an end user, and thinking in terms of what's best.

So if you're using this book, you're a developer, not a designer.

Re:designer not developer (1)

Dynedain (141758) | more than 7 years ago | (#17805312)

As a web designer and developer who works alongside several designers, I can assure you that understanding CSS is not a designer's role, but a developer's role. Once you are involved in coding (whether it's a Turing-complete language or simply a markup language) you are a developer. Now, I point my designer coworkers to various tools that will auto generate CSS, but purely for making it easier for me to interpret their intent (instead of relying on things like Photoshop values for text paragraph formatting which do not match CSS), and also so that they know what fonts and settings are viewable by the site's end users.

Here's a rule of thumb:

If you are defining things like this, you're in the designer role:

Font: Gill Sans
Size: 12.5pt
Leading: 20pt
Tracking: 30
Color: Pantone 420C

Whereas if you are defining things like this, you're in the developer role:

h3 {
        font-family: "Gill Sans", verdana, arial, helvettica, sans;
        font-size: 1.25em;
        line-height: 1.33em;
        letter-spacing: 0;
        color: #CCCCCC;

My question (3, Interesting)

hypermanng (155858) | more than 7 years ago | (#17804164)

It has been updated to account for IE7's ideosyncracies, but does it also cover the other browsers well? Every time I've started really using CSS, I 've gotten frustrated by the way each browser decided to support a different subset of CSS so I had to sit there and try everything before figuring out what non-IE-on-Windows browsers would make of the page. Probably the major browsers support much more of the CSS spec, but I was burned so bad last time I haven't wanted to touch it with a ten foot pole in several years.

Re:My question (4, Informative)

itlurksbeneath (952654) | more than 7 years ago | (#17804686)

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 (1)

owlstead (636356) | more than 7 years ago | (#17806664)

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

Can't see any sarcasm dripping of my glasses neither...

Re:My question (0)

Anonymous Coward | more than 7 years ago | (#17806706)

No, it's there:

<div style="sarcasm:drip">

Re:My question (1)

NoMoreNicksLeft (516230) | more than 7 years ago | (#17806930)

"Hairy" meaning anything even remotely interesting, of course.

Suppose you have some background images, alpha png of course, and you want to do rollovers. Well, the right way to do it is to put all the images into a single image file, so that they'll all load at once, and help conserve bandwidth and http connections. You use background-position and width/height to specify which portion of the image to display where ever whatever.

Of course, 3 months later and IE7 is still lingering in the 15% of all unique visitors range, and IE6 is in the 30% + area.

So, you can do your background-position thing, or your alpha transparency thing. But god help you if you want both, because that nasty-assed filter hack might give you alpha, but totally fucks background-position (it's no longer a real background-image, after all).

IE7 is no better. Still no border-radius? That property alone would save who knows how many ters of bandwidth on the internet by reducing obscene javascript chicanery, round images, and godawful markup (bullets for rounded corners WTF!?!?!?). The same with box-shadow and text-shadow... these are things that a talented programmer could manage in just a few hours each, Microsoft. Worst of all, the pus-filled pimple that is the filter property and its equivalents are just so goddamn lame, that even if we don't mind writing non-validating stylesheets by including them, they won't look comparable enough to the moz/konq/webkit/opera/icab versions for us to use the stylesheet. Thanks Microsoft for guaranteeing another 10 years of using background images all over the goddamned place to do something css shoulda been able to do back in 2003.

Re:My question (2, Informative)

Fozzyuw (950608) | more than 7 years ago | (#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.


Good Book. Bad Index. (4, Informative)

popo (107611) | more than 7 years ago | (#17804170)

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.

Re:Good Book. Bad Index. (1)

Selanit (192811) | more than 7 years ago | (#17807992)

I bought both the Definitive Guide and also the Pocket Reference. They're both by Meyer - the Pocket Reference packs all the vital info into 128 pages. And it really IS a pocket reference, in that it literally fits in my back pocket.

The index in the pocket reference is good. It's got everything I need. But if it didn't, I could give them feedback: there's a line at the bottom saying "We'd like to hear your suggestions for improving our indexes. Send email to index@oreilly.com."

I think I'll send them an email saying that the correct plural of "index" is "indices." Mwa ha ha ha.

Simplify CSS development (1, Insightful)

len_p (782308) | more than 7 years ago | (#17804232)

Want to simplify CSS development? Just make IE disappear. Checking that the CSS works in IE is taking lot of time and is the most frustrating not to mention that you have nothing like Web Developer or FireBug. What to loose your neurons, make your CSS work in IE, hack after hack. bGR@!#!@#! len [www.len.ro]

Re:Simplify CSS development (2, Interesting)

somethinghollow (530478) | more than 7 years ago | (#17804402)

Code for FireFox, Opera, or Safari. Then use conditional comments to load a stylesheet for IE to overwrite the styles it finds problematic. While conditional comments seems like a hack to me, it's an officially supported by IE hack that is officially unsupported in every other browser. If other browsers ever support it, then the "hack" still works. If IE ever stops supporting it, it's just a comment. So far, it's the only method worth using and it isn't nearly as irritating as CSS hacks (that may or may not continue to work). I usually only end up adjusting box model stuff.

That said, IE still needs a lot of work to be compliant with CSS2. It sucks that my/our clients have to foot the bill for Microsoft's sub-par browser (instead of Microsoft).

How can you give it a 9? Should be 0! (0)

Anonymous Coward | more than 7 years ago | (#17804240)

The printed version completely fails to separate content from layout.

What does this book offer... (2, Insightful)

moore.dustin (942289) | more than 7 years ago | (#17804248)

... that all the free online resources offer? Is it merely organized data? Is it the examples? I find all of that readily available for many web technologies and even more so for PHP and CSS. Numerous sites exist that cover everything in several ways too. Is this book simply a consolidation of information that is otherwise free via a google search?

Re:What does this book offer... (2, Insightful)

SavedLinuXgeeK (769306) | more than 7 years ago | (#17804416)

In the same way that a Computer Science text book's information is freely strewn about the internet, so who needs them? The book teaches fundamentals, and the building blocks of CSS, where most examples and tutorials are aimed at getting you to be able to create content as quickly as possible. I can copy programming examples from a website, and even read their reasoning behind it, but I would not assume, for the most part, that they have the experience or authority to properly convey the information to me, the same way that someone who has taken the time to write a technically oriented book would. Basically you are getting experience and wisdom from the book as well as information, and not necessarily so with most online tutorials.

Re:What does this book offer... (1)

falconwolf (725481) | more than 7 years ago | (#17805318)

... that all the free online resources offer? Is it merely organized data? Is it the examples? I find all of that readily available for many web technologies and even more so for PHP and CSS. Numerous sites exist that cover everything in several ways too. Is this book simply a consolidation of information that is otherwise free via a google search?

Some of us prefer hardcopy to read and work through or for reference. I am one, if I read too much on a monitor I get sore eyes and headaches. This doesn't happen when I read books. It's also easier for me to have a book when I try something than when I have to switch between the app I'm using and a browser.

Just because something is online doesn't mean it's better.


Re:What does this book offer... (3, Insightful)

mysticgoat (582871) | more than 7 years ago | (#17805404)

What does this book offer... ... that all the free online resources [do not] offer?

Just one thing: Eric Meyer's insights into the theory and practice of CSS. A web developer reading one of Meyer's books is sort of like an aspiring novelist reading Steven King's book On Writing.

IMHO O'Reilly books are crap (0)

Anonymous Coward | more than 7 years ago | (#17804328)

I can't recommend any specific publisher.. just gotta find the right book for the subject matter.. but less than 10% of my books are O'Reilly.. I'm just often disappointed by them

IE is the roadblock (3, Interesting)

fiannaFailMan (702447) | more than 7 years ago | (#17804388)

CSS is great in theory and should make sites easier to maintain, but in my experience all this advantage is lost when hacking to get IE to support it. I seem to have to support IE OR the rest of the world's web browsers, but I can't seem to get certain pages to support both. I've had to revert back to HTML tables for my page layouts, and I'll be sticking with that until a more CSS-friendly IE becomes more widespread. I just spend a bit of time familiarising myself with CSS and using it for text styling and some positioning within my tables. I'm sure in a year or two it'll become feasible to use CSS exclusively, and I'm quite looking forward to it.

Re:IE is the roadblock (2, Informative)

juiceCake (772608) | more than 7 years ago | (#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.

Re:IE is the roadblock (2, Informative)

8-bitDesigner (980672) | more than 7 years ago | (#17804664)

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:IE is the roadblock (1)

juiceCake (772608) | more than 7 years ago | (#17804966)

I wouldn't knock conditionals. Many developers use some variations to achieve the results they wish.

Re:IE is the roadblock (2, Informative)

Anonymous Coward | more than 7 years ago | (#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.

Re:IE is the roadblock (1)

juiceCake (772608) | more than 7 years ago | (#17805112)

Interesting read. I've experienced none of those problems but will keep them in mind. As for validation, of course, I always make sure they validate.

Re:IE is the roadblock (2, Informative)

brunascle (994197) | more than 7 years ago | (#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.

Re:IE is the roadblock (0)

Anonymous Coward | more than 7 years ago | (#17804708)

If you haven't seen it, check out the css Zen Garden. More than enough practical examples of how to do exactly what you say you want to do.
  http://www.csszengarden.com/ [csszengarden.com]

Re:IE is the roadblock (1)

Serious Callers Only (1022605) | more than 7 years ago | (#17804718)

The best way to deal with this is to design for non-borked browsers, then adjust for IE, with several style-sheets for different versions of IE to account for the bugs. That way Opera, Safari, Firefox and any others will just work, and IE will work as well as it can, till they release a version without all the CSS bugs.

The IE conditional includes are a nice idea - I wish other browsers did that as well, because it would make working around the bugs a lot easier. The majority of your code goes in a normal css file, and then you can isolate bug workarounds in specific files.

<![if lt IE 7]>
Your stylesheet here

You can use a bug in IE Mac to code for that browser too :

<style type="text/css">

What gets me about CSS is that when in use it feels like it was designed by people who didn't really care about

1. The poor people who have to write browsers which deal with all its intricacies
2. Aesthetics

It's difficult to implement because of the complicated box model (I don't think any browser has a completely bug-free implementation of CSS), and it's actually difficult to design things that look nice. Lots of lovely typographical/graphics stuff that should be easy to do (drop caps, hanging punctuation, proper indented paras, multiple column layout) is instead really quite difficult.

Re:IE is the roadblock (5, Informative)

koehn (575405) | more than 7 years ago | (#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:
                        "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.

Re:IE is the roadblock (1)

fyoder (857358) | more than 7 years ago | (#17806110)

For biz sites and such it's a pain, but just for fun sites can do something like this [binary-environments.com] (try it in IE, otherwise a warning: full frontal male nudity). In a non-IE browser it's all css layout. It was 'for fun' and getting the css to work in IE would not have been fun.

Re:IE is the roadblock (1)

BLACKtactx (1015407) | more than 7 years ago | (#17806724)

So, in other words, not to dig or anything, but it sounds like instead of making your css pages work, you have taken the easy way out. Sure its hard, but the reward is great. There is absolutely no excuse to use table based layouts anymore, and ie is CSS friendly, its buggy sure, but completely possible with workarounds and various tricks. Good luck with the shift, i recommend switching fully now :-)

Re:IE is the roadblock (1)

fiannaFailMan (702447) | more than 7 years ago | (#17808000)

not to dig or anything, but it sounds like instead of making your css pages work, you have taken the easy way out
And not to dig back or anything, but I spent about a week trying to get the page to work before deciding I had better things to spend my time on. Using tables I got it rendered in a few minutes. Right now the rewards are just not big enough to justify this effort. For layout changes, Dreamweaver will proliferate them throughout the site. Might not be as slick as CSS, but it works. Sometimes the 'easy way out' is what you need.

Not the only positive of CSS. (2, Funny)

shawn(at)fsu (447153) | more than 7 years ago | (#17804420)

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.
Or in the case of MySpace, CSS allows a user to make a website with no content look better by overdosing on the style.

Might be worthwile (3, Insightful)

Da Fokka (94074) | more than 7 years ago | (#17804728)

I haven't read the book, but given the fact that creating a simple three column layout that works on every browser and looks good too is far from trivial, one can conclude two things:
  • Something's wrong with CSS

  • This book may be worth buying

Re:Might be worthwile (2, Interesting)

edmicman (830206) | more than 7 years ago | (#17804984)

Heh, I agree. I, too, will probably have to check this out, but I know I've heard all over how using tables for layout is bad and using CSS instead is Teh Good. But every time I try and do a layout that would take two minutes with a table, and do it it CSS, it takes many times longer to get things to actually *work* and look right. Float that to the left! Oops, once I add another column, they're both squished to the top! Etc etc....

Re:Might be worthwile (2)

pwizard2 (920421) | more than 7 years ago | (#17805414)

I'm sure that admitting this is going to really hurt my karma, but in situations where I need a 3 column layout, I just use a table to create the columns because it always works.

I've never once had a client that actually cared about what I did with the code or if I used 100% kosher W3C-approved code. The only thing that all of my clients have wanted to hear is, "This works to solve the problem at hand and it will always work reliably."

I don't like to write kludgy code if I can help it because I consider it to be sloppy, but sometimes I just don't have a choice but to use workarounds.

Re:Might be worthwile (1)

Da Fokka (94074) | more than 7 years ago | (#17805942)

I totally agree. Doesn't the fact that's it's so darn hard to make a simple three column layout mean that CSS is broken? I do exactly the same thing like you: using tables and hoping blind people will understand (I use ALT tags on every image to compensate ;).

Re:Might be worthwile (0, Troll)

NoMoreNicksLeft (516230) | more than 7 years ago | (#17807182)

Div, float: left; Div, float: left; clear: left; Div, float: left; clear: left;

Oh my god, I just solved 3 column layouts!

Subscribe to the www-style mailing list, please, and let those chumps know how badly CSS is screwed up. They've just been tinkering around not knowing what in the hell they've been doing all these years, after all.

Re:Might be worthwile (1)

emurphy42 (631808) | more than 7 years ago | (#17806496)

Under what circumstances does the following not work well?

        position : absolute;
        top : 10px;
        left : 10px;
        width : 20%;

        position : absolute;
        top : 10px;
        left : 25%;
        right : 25%;

        position : absolute;
        top : 10px;
        right : 10px;
        width : 20%;

NOT! CSS is Fine... (0)

Anonymous Coward | more than 7 years ago | (#17806646)

it is IEs purposeful mis-implementation that provides the developer world with lots of headaches.

if you want auto length adjusting 3 columns with header and footer, try and get a general template and then modify it. i was unable to do it on my own and, given what i've seen that works, i would likely have jumped off a building before i got it to work.

here are numerous templates you can modify:

http://www.pmob.co.uk/temp/3colfixedtest_4.htm/ [pmob.co.uk]

you can play with the URL to find a number of other css examples - some pretty corny and some pretty cool.

Re:Might be worthwile (1)

Dirtside (91468) | more than 7 years ago | (#17807044)

but given the fact that creating a simple three column layout that works on every browser and looks good too is far from trivial, one can conclude two things:

        * Something's wrong with CSS
Nothing's wrong with CSS on its own terms... but I still don't understand why people think that Cascading Style Sheets should be used for layout.

Granted, HTML wasn't designed with layout in mind, either, but it's a hell of a lot simpler to make a table with HTML than it is to futz around with CSS positionings. Which is probably why most people still do it that way.

Better thing to conclude (1)

Aewyn (836766) | more than 7 years ago | (#17807422)

I haven't read the book, but given the fact that creating a simple three column layout that works on every browser and looks good too is far from trivial, one can conclude two things:

  • Something's wrong with CSS

A better conclusion:

  • Something's wrong with the CSS support in at least one browser

Specifically, if IE supported display: table-cell et.al., such a layout should indeed be quite trivial. But support for this is apparently still missing, despite the fact that the relevant spec is more than 5 years old.

Head First XHTML & CSS (1)

slavelayer (956212) | more than 7 years ago | (#17805192)

The best XHTML & CSS book I have ever read is from the Head First series.
Head First focuses on underlying concepts and theory first and foremost!

Is CSS a Failure? Use wysiwyg web editors? (2, Insightful)

oldCoder (172195) | more than 7 years ago | (#17805444)

If you need a 536 page book to "Master" such a trivial part of web development as page and text formatting then CSS is a failure. Are there any wysiwyg "Html editors" that produce portable CSS? If so, then the book is obsolete.

As any Word(tm) user knows, page layout and text formatting should be done Visually. I don't code in assembler any more. And I shouldn't have to write text-formatting codes. Troff was obsolete years ago! CSS is just Troff on steroids.

CSS is such a pain in the butt we should all go back to using tables. I really think it's easier.

Re:Is CSS a Failure? Use wysiwyg web editors? (2, Insightful)

pwizard2 (920421) | more than 7 years ago | (#17805526)

I'm not sure if it's true anymore since I hand-code but back in the day the main problem with WYSIWYG editors is is that they tended to generate really bad code that was difficult to go back and edit manually. Some of the worst ones generated code that was deprecated in addition to this.

Even Adobe Imageready (as of CS2) uses a obsolete and backwards apprach to creating rollovers from image slices. This can be done with CSS, but even the latest version of Imageready uses a badly depecated table & javascript method that IE6 with SP2 will disable by default. It is for this reason that I don't use Imageready for rollovers anymore.

Re:Is CSS a Failure? Use wysiwyg web editors? (1)

Coffee Warlord (266564) | more than 7 years ago | (#17805978)

CSS is such a pain in the butt we should all go back to using tables. I really think it's easier.
Go back? I never stopped. I use CSS for text/form styles, and that's about it. Good old
fashioned HTML tables are where it's at. I'm perfectly happy sticking with what works.

CSS is pretty much the one thing developer-wise that really gives me that 'dinosaur' feeling.
Just don't see the need for those massive CSS files that try and lay out an entire site for
you. I'm not sure whether I'm just getting old and curmudgeony, or there really isn't a good
reason for laying out stuff in CSS.

Hell, might be both. :)

Re:Is CSS a Failure? Use wysiwyg web editors? (3, Insightful)

itsdapead (734413) | more than 7 years ago | (#17806414)

As any Word(tm) user knows, page layout and text formatting should be done Visually.

What any Word(tm) user with any experience knows, is page layout and text formatting should be done in anything other than fricking Word, except you have to send in a fricking Word file and exporting Word from any other applications almost works. At least OpenOffice is annoying and buggy for free.

Bearing in mind the web was invented by a bunch of physicists its a wonder that it uses HTML and not LaTeX Now, that would be fun: a default page design reflecting the acme of the typographers art (LaTeX output is really beautiful) and a vertical learning curve if you wanted to change that style.

Re:Is CSS a Failure? Use wysiwyg web editors? (1)

JakeD409 (740143) | more than 7 years ago | (#17807800)

As someone who has spent an equal amount of time designing with and without CSS, I can say that CSS makes things infinitely better and easier, once you stop fighting it. Take a few weeks to really learn it inside and out, and learn good CSS practices, and you'll never look back.

As any Word(tm) user knows, page layout and text formatting should be done Visually.

Unfortunately, every WYSIWYG editor produces absolute crap for code. I agree that it would be wonderful if you could just edit a page visually and have the results be just what you wanted, but once you get out of your program's design view and into your web browser, everything looks completely wrong (and if it doesn't look wrong in your web browser, it probably looks wrong in everyone else's).

One final thing; if you're a programmer (and it sounds like you are), you should recognize one of the largest advantages to CSS over tables: separation of presentation from content. The ability to isolate what you are working on makes maintenance worlds easier. The advantage is very similar to object oriented over procedural.

I bought it two weeks ago, it contains errors. (0)

Anonymous Coward | more than 7 years ago | (#17805554)

I bought it two weeks ago, it contains errors - for instance, there's no "outline" css parameter on IE7, though Eric Meyer talks about it at length.

Eric Meyer, the HTML-TABLE killer!! (0)

Anonymous Coward | more than 7 years ago | (#17805786)

Wasn't he the guy who made it against the laws of HTML to use the 'TABLE' tag? and to instead use DIV and CSS??

The concept was simple: Save time and code by using CSS instead of TABLE. The reality was that you'll spend now even more time debugging such code across all browsers than you would if you used TABLE. But, in web2.0 fanboy world, he is a hero.


ProgrammingBooks.org (1)

draed (444221) | more than 7 years ago | (#17806016)

I hate to shill my own stuff, but I recently created a site for ranking programming books based on category(language, api, etc) that I think most developers will find very useful. Basically programmers rank their top 5 books for each category. It's very simple, and hopefully useful. It's in a pain finding quality programming books. The only real resource is browsing/searching through amazon, which can be a real pain.

http://www.programmingbooks.org/ [programmingbooks.org]

For example, here are the top ranked CSS books: http://www.programmingbooks.org/CSS [programmingbooks.org] (not many users have ranked css books)

Ohhhh JOY Yet Another Mystery Novel (YAMN) (1, Flamebait)

FlyingGuy (989135) | more than 7 years ago | (#17806836)

Yeah you heard it here 1st. A new acronym, YAMN. CSS is becomming even more of a joke then it already is. And the worst part is that is a cruel joke.

As many have said in this string of posts, without the use of tables, it is no longer a job for the general web creator to create a three column lay out, without being a complete CSS guru and even for them it gives them headaches.

In my estimation, what the designers of CSS have managed to do is crush the life out of the promise that once was the a usable, if slightly clumsy, way to present information.

As an example. Using un-ordered lists to create menus. Its a complete and total hack, and I mean to use the word hack in the most derogitory manner possible. Instead of comming up with a menu framework that was designed from the ground up to be menus they used this stupid hack and think they are so cool. News for you, your not cool, your not smart nor are you clever.

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. So while you geniouses are comming up with HTML, DHTML, XHTML, CSS1, CSS2, etc. ad nausium, you cant seem to fit that simple part in there. Every freeking page has to have the complete menuing system in it and if anything has to be changed in it, like CONTENT someone has to go and edit 1 to n freeking html files, sorry, but for that you guys just plain SUCK.

Now I just know someone will think in regard to that last bit, that it should just be in a database! Well sure as shootin! Except why on fucking earth does a 10 page web site need to have a complete CRM system behind it? Why should it even have a database! Then you will say, but it is only 10 pages, you should write a VI or better yet an EMACS macro to handle that. Better yet anyone who would suggest that should get rectaly examined by the phalus of a donky. UL's twisted into menu's are not trivial and can be broken quite easily. Develop a MENU interface if you are determiend to turn something loosley associated with desktop publishing into a full on interactive bit of software.

The bottom line is this, if you want people to really embrace CSS then FIX IT. Get the venders to fix the browsers and if they wont fix it, then stop twisting CSS all over itself to accomodate them and just let it those browsers fail and the market will fix it.

Re:Ohhhh JOY Yet Another Mystery Novel (YAMN) (2, Interesting)

Shados (741919) | more than 7 years ago | (#17807534)

Indeed. Honestly, CSS started from a good idea. CSS 1 handled, well, styles, like fonts, colors, etc. Thats good, and CSS is good for that. It actualy makes sense for it, the syntax is peachy good.

Its when someone decided "Woooo, lets divide the page in 2, the logical structure and the layout!" that it got to become hell (aka: CSS2. For this post, I'll talk as if CSS2 was implemented at 100% in all browsers, to avoid some bozo saying "its microsoft's fault if you hate CSS blah blah blah).

Since CSS came about several years ago, back in the days, it probably made sense. Today, it doesn't.

A fairly typical enterprise web application has (for example, pulling stuff out of my ass):

a layer of stored procedures
a data access layer
a data transformation layer
business objects
a business logic encapsulation layer
a business service layer
a web service or remoting layer to distribute the app
a controler layer for the UI
the actual UI.

A lot of these gets split in more categories (validation, security, etc). Now, some bozos want to start splitting it up even more. Semantic markup, styling, and if you push it, transformation (XSLT), and more. It makes sense in a web site, or a simple business front ends, like mmost transactional ecommerce sites, that have like, 5 different pages that need to be maintained a lot. But when you have several hundreds pages with vastly different purposes...it just starts being pointless. The CSS1 part still has its place, to make a "theme" for the entire site. But positioning? You need 1 stylesheet -per- page, since each page is 90% different aside from the navigation. And most of the semantic part is generated from the layer right under the UI layer, so the structure vs display is -already- split. Its just redundant.

But since all the wackos that don't get that are extremely vocal, and have been pushing it like crazy, the browsers and the web in general are going that way. So for the being, we're stuck with it. Even worse, I recently got hired by a top fortune 500 company, and amazingly enough, I'm the only one who semi-advanced (relatively speaking) knowledge of web interface technologies, so I'm stuck dealing with all of it, because when trying to explain to the other programmers whats the difference between position: relative and position: absolute, I get blank stares. Oh well. At least thats job security...

CSS? (1)

Gno (970625) | more than 7 years ago | (#17807104)

when I saw the topic, I thought, Hmm, this could chance Counter Strike: Source forever, Finally! a good guide for noobies.
Load More Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Sign up for Slashdot Newsletters
Create a Slashdot Account