'Why is 'projection' an invalid value for the media attribute in a link tag?
According to the w3.org validator:
<link rel="stylesheet" href="css/style.css" media="screen, projection, tv" />
does not seem to be valid anymore due to the projection
value.
I don't remember exactly, but this way Opera in Fullscreen is included. Probably Opera will load the file with media="screen" too.
Why is this invalid now? Is there another way to give extra CSS to "fullscreen / projection" devices?
Solution 1:[1]
Maintainer of the W3C HTML checker here. About 3 weeks ago, I implemented and pushed to the production W3C HTML checker the change that emits these new errors; this change: https://github.com/validator/validator/commit/66c739a49afd050226a91f2b7f49662e0dcc9a09
I made that change in order to bring the HTML checker in conformance with the current CSS Media Queries spec. As noted in an earlier answer:
[...] MQ4 basically deprecates all the CSS2.1 media types except
all
,screen
andspeech
, citing the use of media feature detection instead, saying:In addition, the following deprecated media types are defined. Authors must not use these media types; instead, it is recommended that they select appropriate media features that better represent the aspect of the device that they are attempting to style against.
Presumably, the validator is marking the value invalid because it violates the stipulation that "Authors must not use these media types".
Solution 2:[2]
The complete error message says:
Bad value
screen, projection, tv
for attributemedia
on elementlink
: Deprecated media typeprojection
. For guidance, see the Media Types section in the current Media Queries specification.
... and "the current Media Queries specification" links to Media Queries 4, which is currently in development. MQ4 basically deprecates all the CSS2.1 media types except all
, print
, screen
and speech
, citing the use of media feature detection instead, saying:
In addition, the following deprecated media types are defined. Authors must not use these media types; instead, it is recommended that they select appropriate media features that better represent the aspect of the device that they are attempting to style against.
Presumably, the validator is marking the value invalid because it violates the stipulation that "Authors must not use these media types".
Solution 3:[3]
I think it’s valid HTML5:
The
media
attribute of thelink
element says:The value must be a valid media query.
It links to this definition of "valid media query";
A string is a valid media query if it matches the
media_query_list
production of the Media Queries specification. [MQ]It links to this specification:
Media Queries (URL: http://www.w3.org/TR/css3-mediaqueries/), H. Lie, T. Çelik, D. Glazman, A. van Kesteren. W3C.
The current Recommendation of http://www.w3.org/TR/css3-mediaqueries/ is:
The mentioned
media_query_list
is defined in section 3:The media query syntax is described in terms of the CSS2 grammar. As such, rules not defined here are defined in CSS2. The
media_query_list
production defined below replaces themedia_list
production from CSS2. [CSS21]It links to the Recommendation http://www.w3.org/TR/2011/REC-CSS2-20110607
projection
is one of the recognized media types
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | BoltClock |
Solution 3 | Community |