0

What is the practical benefit to keep CSS 100% validated (not using any hacks), for client's projects.? even if there is no cross browser problem.

And what type of problem i can face in future if i do not maintain CSS validity 100%.

Jitendra Vyas
  • 148,487
  • 229
  • 573
  • 852
  • 3
    Downvoted because it seems like a pointless question. What's the point in doing anything correctly? The answer should be obvious, if it doesn't validate 100% you are more likely to hit problems on some browsers or situations you didn't anticipate. I say more likely because browsers are pretty robust and no-one is perfect anyway. – NibblyPig Apr 13 '10 at 21:48
  • 1
    A benefit is that IE won't be able to render it :). – rook Apr 13 '10 at 21:56
  • Actually I find IE is far more robust than other browsers. Firefox users etc. are the ones always banging on about how IE doesn't follow standards... the reason for that half the time is because the developers don't follow the standards either, especially not 100% as the answer below states in agreement. IE does rather well in my opinion. – NibblyPig Apr 13 '10 at 22:00
  • @SLC: you are confusing cause and effect... – Leo Apr 13 '10 at 22:02
  • possible duplicate of http://stackoverflow.com/questions/1337928/whats-the-point-of-valid-css-html – Jørn Schou-Rode Apr 15 '10 at 08:57

4 Answers4

1

Practical....hmm, I suppose that you can say to the client "it's 100% validated"? In practice if you're doing anything complex (e,g, opacity) it's extremely difficult to maintain 100% valid CSS, conditional stylesheets it a way to eliminate most of these cases, but not everything.

Do what works in this case, not what the validator tells you. That being said, don't ignore validation errors that are legitimate errors not there for a specific reason.

Nick Craver
  • 623,446
  • 136
  • 1,297
  • 1,155
  • but if we use css some css hacks then validator gives parsing error. can we ignore these errors – Jitendra Vyas Apr 13 '10 at 17:34
  • 1
    @metal-gear-solid - If you've tested in all other browsers or it's a **well known** hack-around without side-effects, then yes. Aside from those cases, don't ignore them. – Nick Craver Apr 13 '10 at 17:37
  • Are these errors ok to ignore http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Ftjkdesign.com%2Fez-css%2Fcss%2Fbase.css&profile=css21&usermedium=all&warning=1&lang=en – Jitendra Vyas Apr 13 '10 at 17:38
  • 2
    @metal-gear-solid - It looks like all your errors are resulting from * attributes, though other browsers are currently ignoring these, sometimes explicitly (they know they're IE intended), that *may* change. To be safe, break those `*attribute: value` settings into a [conditional stylesheet](http://css-tricks.com/how-to-create-an-ie-only-stylesheet/) loaded after this one only for IE, then you an be valid and safe, best of both. – Nick Craver Apr 13 '10 at 17:48
1

The fact that a page looks correct with a current version of a browser doesn't guarantee that it will in a future version.

If you use non-valid CSS, you might be inadvertently relying on a bug in the rendering code, which, if it gets patched, could break your layout.

If you use valid CSS, however, any standards-compliant browser should display the page correctly, as long as it follows implements that version of the CSS standard.

Sebastian Paaske Tørholm
  • 49,493
  • 11
  • 100
  • 118
  • for example yui reset is not valid http://yui.yahooapis.com/3.1.0/build/cssreset/reset.css – Jitendra Vyas Apr 13 '10 at 17:37
  • This is correct. Browser rendering engines aren't static, they are continually changing, and almost exclusively they change to become more standards-compliant, which means that if you write valid CSS, browsers will be more likely to display it correctly in the future, but if you write non-valid CSS, they will be *less* likely to do so. That means more work for you in the future. – tloflin Apr 13 '10 at 17:38
  • @tloflin - but mostly we use hacks for old browsers and they will not get any new updates. like Microsoft is focusing on IE 8 and 9 not on IE 6 and 7 – Jitendra Vyas Apr 13 '10 at 17:40
  • @metal-gear-solid, we use hacks for old browsers which are continually being phased out, while new browsers that break those hacks are being introduced. Now obviously if you must include a certain feature--even for old browsers--that can only be done via a hack, you have to use the hack, but your question implied that not using the hack was possible. – tloflin Apr 13 '10 at 18:13
0

In short. If the validator complains about vendor specific/css3 properties like -webkit-border-radius ignore it. Anything else you should fix.

Javier Parra
  • 2,020
  • 2
  • 18
  • 32
0

The practical benefit to keep CSS 100% validated is also the fact that you can detect easier and much faster a mistake in your code.

For example, during website development, I always use a browser which shows me clearly when XHTML or CSS are invalid (green/red icons). It saved me a few hours of my life: sometimes, if I work with very basic editor, if I misspell something in CSS code, I notice it immediately when I see in the browser that CSS is nevermore valid.

Note: it also helps a lot to have 100% XHTML. Sometimes an invalid XHTML is caused by an error in code-behind.

Arseni Mourzenko
  • 50,338
  • 35
  • 112
  • 199