The W3C CSS Validation Hack (no Opera)

I often exercised about »The W3C CSS Validation Service«. This web service has to find errors and not to create them! This is why many developers ignore »The W3C CSS Validation Service« and only respect the »Markup Validation Service«.
Yesterday I installed some plugins and the W3C CSS errors doubled. So I thouht about a solution to display no stylesheets for »The W3C CSS Validation Service«, like the German HP website.

My solution

is similar than Paul Irish's Conditional Comments. Let's rock »The W3C CSS Validation Service«

<!--><link rel="stylesheet" media="all" type="text/css" href="path/to/your/stylesheet"/><!----> 

Make sure the stylesheet integration is between




This way is very easy and doesn't cause any additional HTTP-Requests.

The result

Congratulations! No Error Found.
This document validates as CSS level 3 !
This document validates as CSS level 2.1 !
This document validates as CSS level 2 !
This document validates as CSS level 1 !
No style sheet found

Browser compatibility

I have tested The W3C CSS Validation Hack with

  • Chrome 13
  • Chromium 12
  • Firefox 3.6 and 6
  • Safari 5
  • IE 5.5+

Hey, IE 5.5 is able to implement the hack well. I'm sure you wouldn't have any problems with every other browser except Opera.
I hope you understand my W3C CSS Validation Hack (my English isn't very well :-\). This hack isn't very well to use, because it doensn't work in Opera. Opera is a [swot] and W3C is his teacher. The W3C CSS Validation Hack will only work if there is no doctype. Do you have a better solution? Post a comment.

Hello World!
Blogging with DokuWiki and mnml-blog... rules!
QR Code: URL of current page
Syndiaction/RSS Feed
Recent Comments