Search code examples
htmlmedia-queriesw3cw3c-validation

-webkit media query HTML5 Validation


The following code will not validate with W3C HTML5 checker because the media query -webkit.... begins with a symbol and not a letter what is an alternative solution so that my code will validate although this is valid HTML media queries I believe.

media="screen and (-webkit-device-pixel-ratio: 1.5)"


Solution

  • this is valid HTML media queries

    It isn't. You are using the -webkit prefix (indicating an experimental vendor implementation and not a standard).

    You can either use it, or you can be valid.

    (There may also be a way to hide it from a validator by injecting it with JavaScript, but that adds complexity and more likelyhood of things breaking. Validation is a tool, not a competition).