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?

  • January 11, 2007
  • Comments closed
  • Posted in

Comments

1. January 11, 2007 by Shimon

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. January 12, 2007 by Georg

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. January 12, 2007 by Robin

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. January 12, 2007 by Matthew Pettitt

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. January 12, 2007 by Robert Wellock

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. January 12, 2007 by grad

@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. January 16, 2007 by Jens Meiert

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

9. February 14, 2007 by Web Masters

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. March 26, 2007 by Sven Fischer

Hi,

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

Greetings from Germany Sven

Sorry, comments are closed for this post.

Information, sponsorship, and externals

About the author

Roger Johansson is a Swedish web professional specialising in web standards, accessibility, and usability. More about me and this site.

Subscribe

Looking for web hosting?

Try DreamHost!

Use the promo code 456BEREASTREET3 to save USD 20 when you sign up!

Latest articles

Validation statistics from Nikita the Spider Comments off
An analysis of the sites crawled by the bulk validation tool Nikita the Spider during March 2008.
Authentic Jobs API and Affiliates program Comments off
The Authentic Jobs job listing service now has a public API and an affiliate program.
What does Acid3 mean to you and me? Comments off
Opera and Apple have announced that their web browsers pass the Acid3 Browser Test, but how will that help web designers and developers?
Designing Web Navigation (Book review) Comments off
Learn the fundamentals of navigation design and design better navigation systems for large and small sites as well as for web based applications.
DOMAssistant bundle for TextMate Comments off
To save keystrokes and speed up development I have created a DOMAssistant bundle for TextMate.
First impressions of Internet Explorer 8 Beta 1 Comments off
My impressions after trying out Internet Explorer 8 Beta 1 for a couple of days.

More articles

Favourites, here and elsewhere

Affiliation

  • NetRelations
  • Kaffesnobben
  • Dagens recept
  • 9rules network member

Support this site

Show your support by buying a book or two from SitePoint or getting me something from my Amazon Wish List.