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:
<style type="text/css" media="screen,projection">@import '/css/main.css';</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):
<STYLE media="screen, print" type="text/css">p.special { color: rgb(230, 100, 180) }</STYLE>
So why doesn’t the CSS Validator know that?
- Previous post: Wired on the 2006 top ten mistakes in Web design
- Next post: Elements and Attributes in HTML 5
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.
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.









Comments
May be just because they are still hardly working on it?
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.
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.
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.
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...
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.
@Wolfgang
Media type
projectionis used by Opera to act as a presentation tool. In full-screen mode Opera ignoresscreenmedia type and appliesprojectionmedia type and pagination. It is called OperaShow.But who the hell uses constructs like this ...!? 0:)
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.
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.