vote up 1 vote down star

In your experience, what are the "real world" consequences of using a stylesheet that does not pass the W3C CSS Validator?

Lower search engine ranking?

Difficulty for other devs to interpret?

World hunger?

I am the only person editing my CSS, and I prefer not to separate it into an "ie only" file. I use a lot of the following, which does not validate:

div {
    zoom: 1; /* proprietary ie */
    _color: greenish; /* proprietary ie6 */
    *color: orangish-yellow; /* proprietary ie6 and ie7 */
    -moz-border-radius: 5px; /* proprietary firefox */
}
flag

closed as not a real question by joshhunt, Diago Nov 1 at 12:13

It's difficult to tell what is being asked here. This question is ambiguous, vague, or rhetorical and cannot be reasonably answered in its current form.

2 Answers

vote up 2 vote down check

I've run into some very difficult-to-troubleshoot CSS problems that were ultimately traced to a missing semicolon, extra bracket, or other syntax problem in a CSS file. If your CSS file can be validated, it's easy to find these issues; if your CSS file contains a lot of garbage that isn't expected to validate, it's harder.

Put the IE-specific stuff in a separate file. (I know you said you don't want to do that, but it really does have its benefits.)

link|flag
I'm actually leaning that way right now. The question now is, use IE conditional comments or try and whip up something with PHP? The feedback is very much appreciated. – Jeff Oct 31 at 15:08
1  
I personally think conditional comments are the right tool for the job here. Server-side browser sniffing is trickier than you might think-- there are lots of variants of each browser and making sure you serve the right thing to each one can be painful. Conditional comments behave consistently across variants. – davidcl Oct 31 at 17:41
vote up 1 vote down

World Hunger, definitely. Each invalid line removes a random piece of food from a starving child.

More seriously, it's exactly the same as invalid-yet-still-renders HTML. It's fine, but may not be in the future. There's no guarantee it'll still be supported next version of HTML/CSS, or that another browser won't break entirely with it. Keeping valid means your site isn't going to suddenly break in a standards complient browser (as in, not IE, where you are forced to break standards just to get it working)

link|flag

Not the answer you're looking for? Browse other questions tagged or ask your own question.