Search code examples
cssvalidationparse-error

CSS3 Parse Error Lexical error


I keep getting this error and am not sure why it pops up when I validate it. Can anyone explain this to me and how to fix it? The error is this: 246 #copyright Parse Error Lexical error at line 249, column 2. Encountered: " " (32), after : "@"

Here is the code. I am starting with line 246, which I guess where it starts...not really understanding what is going on here. Line 246 is the closing bracket for my smartphone css. I can post that also if you need it. Much appreciated.

}
/* ----- Tablet ----- */
@ media screen (min-width: 481px) and (max-width: 769px) {
   div#wrapper{
      margin: 0 auto;
      padding: 1em;
      width: 98%;
    }
    header h1 {
        font-size: 1.8em;
    }

}

Solution

  • The error message is saying that the parser encountered a space " " after the "@" following line 246. The space is not supposed to be there, hence the parse error; you need to remove it.

    You are also missing an and from this media query.

    Here is the correct syntax:

    @media screen and (min-width: 481px) and (max-width: 769px) {