SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question CSS3 Media Queries and W3C Validator

    Hello,

    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)
    Code:
    <link type="text/css" rel="stylesheet" media="screen and (min-width: 320px) and (max-width: 480px)" href="../css/screen/iphone.css" />
    2. (media queries included in main CSS file)
    Code:
    @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):

    Code:
    unbekanntes Medium screen and (min-width: 320px) and (max-width: 480px)
    which, in English, means something like

    Code:
    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!

    Loremy

  2. #2
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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):

    Code:
    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!

  3. #3
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,598
    Mentioned
    411 Post(s)
    Tagged
    7 Thread(s)
    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.

  4. #4
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    39,818
    Mentioned
    158 Post(s)
    Tagged
    4 Thread(s)
    Yes it seems to be a long standing bug with the validator.

  5. #5
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your feedback, guys.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •