The W3C CSS Validator Fuji release

A new version of the W3C CSS Validator (The Fuji CSS Validator release) was released in mid-December. It now defaults to validating against CSS 2.1, which is good, and the layout has been improved, which is also good. However I find it really annoying that the long-standing Bug 697 - multiple media types unrecognised is still there, preventing easy validation of CSS that is imported like this:

  1. <style type="text/css" media="screen,projection">
  2. @import '/css/main.css';
  3. </style>

From the definition of the media attribute in Style Sheets in HTML documents:

This attribute specifies the intended destination medium for style information. It may be a single media descriptor or a comma-separated list. The default value for this attribute is “screen”.

The same syntax is even used by the W3C in an example in the HTML 4.01 Specification (14.4.1 Media-dependent cascades):

  1. <STYLE media="screen, print" type="text/css">
  2. p.special { color: rgb(230, 100, 180) }
  3. </STYLE>

So why doesn’t the CSS Validator know that?

Posted on January 11, 2007 in CSS, Quicklinks

Comments

  1. May be just because they are still hardly working on it?

  2. January 11, 2007 by Wolfgang

    I doubt it’s something very high up on their list to fix. Who actually uses ‘projection’ anyway? And having it say “screen, print” is a redundant, since screen is the default and without a separate print stylesheet that’s what it’s going to print.

  3. I’ve noticed those bugs, and since I use ‘multiple media types’ regularly it means nearly all my stylesheets are “not valid” - even if the “non valid” parts look like copies from the CSS specs.

    Well, I can live with that and I couldn’t care less about “valid CSS” as long as the validator itself is at the level it is.

  4. Time for the obligatory “It’s open source, you can submit a patch” ;)

    Actually, I might see if I can get an install of the validator running later; try and fix some of the outstanding bugs if I can.

  5. Hmmm… There still seem to be a few other problems as well…

    Just got a “Please, validate your XML document first!” message, yet when the same document is put through the XHTML validator, it gets “This Page Is Valid XHTML 1.0 Transitional!” (it’s a CMS basaed page, and the CMS isn’t strict enough for strict).

    So, either the CSS validator has a working XHTML checker, and the XHTML validator is broken, or the CSS validator’s XHTML checker is buggy…

  6. Interesting as the XML Declaration should be at the start of the document.

    You’ll notice it won’t detect a CSS stylesheet on my website just using the site URL rather than the full URI to the *.css file because I use XHTML and ‘xml-stylesheet’.

    It looks like the HTML Validator doesn’t look too deeply regarding the string: “<?foo ?>” and must just ignore it even if it appears in the body.

  7. @Wolfgang

    Media type projection is used by Opera to act as a presentation tool. In full-screen mode Opera ignores screen media type and applies projection media type and pagination. It is called OperaShow.

  8. But who the hell uses constructs like this …!? 0:)

  9. Hi, my site is http://www.innovateidea.com in xhtml1.1 & 1.0, I have all my pages valid according to the w3 standards, but why is that w3.org itself has few invalid pages, over 10 pages.

  10. Hi,

    interesting article. Does the CSS declaration work on old browser versions? What is with the old Netscape versions?

    Greetings from Germany Sven

Comments are disabled for this post (read why), but if you have spotted an error or have additional info that you think should be in this post, feel free to contact me.