Le 16 mars 2013 à 09:37, Tom Livingston <tom...@gmail.com> a écrit :

> This may shed some light:
> 
> http://stackoverflow.com/questions/8549529/what-is-the-difference-between-screen-and-only-screen-in-media-queries

That stack overflow page refers to this passage in the MQ level 3 spec:
> The keyword ‘only’ can also be used to hide style sheets from older user 
> agents.
(above example 9)

I’ve always found that statement about the ‘only’ keyword in the CSS MQ spec 
somewhat ambivalent. Inside a stylesheet, a User Agent that only implements 
CSS2 will treat as invalid the following:
@media screen and (color) {}
@media (width:200px) {}
And ignore everything until the closing ‘}’.
See CSS2.1:4.1.7 and 4.2

The only reasonable use case for using the ‘only’ qualifier as a way to hide 
something from older UA’s is this:
@media only screen {}
(and specify that the style rules should only be used for screen media)

On the other hand, the ‘only’ keyword can eventually be useful to hide a 
complete stylesheet from an older UA that implements HTML 4 correctly. Linking 
to a stylesheet along these lines _should_ be accepted by such an UA:
<link rel="stylesheet" href="style.css" media="screen and (min-width: 100px)">
(The UA will truncated after the ‘screen’ media type)
but this _should_ be ignored:
<link rel="stylesheet" href="style.css" media="only screen and (min-width: 
100px)">
(the older UA will truncate after the ‘only’ keyword, and decide it is an 
invalid media type)

see list item 2 under
http://www.w3.org/TR/1999/REC-html401-19991224/types.html#type-media-descriptors

Philippe
--
Philippe Wittenbergh
http://l-c-n.com




______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to