CSS3 Media Queries and W3C Validator


I am starting to work with CSS3 media queries and I am baffled that the W3C CSS validator for CSS level 3 profile offers different results (wrong vs. correct) for the following two notions:

  1. (media queries in html head)
<link type="text/css" rel="stylesheet" media="screen and (min-width: 320px) and (max-width: 480px)" href="../css/screen/iphone.css" />
  1. (media queries included in main CSS file)
@media screen and (min-width: 320px) and (max-width: 480px)

If I use version 2, my file is validated as correct, but using version 1, I get the following message (in German):

unbekanntes Medium screen and (min-width: 320px) and (max-width: 480px)

which, in English, means something like

unknown medium screen and (min-width: 320px) and (max-width: 480px)

Can anybody confirm this?
If so, what’s wrong with this notion?

I know that, performance-wise, version 2 (including media queries in the main css file) is even better than including them in the html head, but I am still very interested in finding out about the problem just mentioned, since I would like to have both options available, depending on different needs.

AFAICS from this W3C site on CSS3 media queries, both versions should yield the same validation results, shouldn’t they?

Thanks a lot for any help!


I just found an old post on CSScreator providing the correct English version of the error message you get when putting the media queries in the html head (see my above posting):

unrecognized medium screen and (min-width: 320px) and (max-width: 480px)

That was way back in 2008, and it seems this bug still hasn’t been fixed.

There even was a thread on these forums, but the discussion somehow lost focus and didn’t come to a conclusion.

If anybody among you doesn’t get this error message when putting the media queries in the html head (like quoted in the opening post), please give us some feedback. Thanks!

O well, I don’t worry too much about the validator anyhow. I just check what it says to see if there are any real problems. That’s all it’s good for.

Yes it seems to be a long standing bug with the validator.

Thanks for your feedback, guys.