Re: [css3-mediaqueries] Width/Height Clarifications

Boris Zbarsky wrote:
> Andrew Fedoniouk wrote:
>> What is the difference?
>> These two statements:
>> @import url(a.css) print; and
>> @import url(b.css) screen;
>> Are they "unsupported media types" or "media type that you might 
>> switch to later" ?
>
> The difference is simple. If there is a circumstance under which your 
> UA would apply the rules, you need to bother loading the stylesheet. 
> If there is not, you don't.
>
> So if your UA doesn't support the "print" medium at all, no need to 
> load a.css in your example.
>
>> According to your previous message you treat them as "media type that 
>> you might switch to later"
>
> In Gecko, yes, since we do support printing.
Printing was just an example.
Question was about MQs actually.

@import url(a.css) min-device-width:800;
and a.css contains:
@media max-device-width:1200
{
p { color: red;}
}
will p get color red if your screen happens to be 640 pixel wide?

Specs (CSS 2.1 and CSS3) are not clear on the subject.
They say (http://www.w3.org/TR/css3-cascade/#at-import) you "can" skip 
a.css loading.
So you may load or you may not load that conditional import. So is 
ambiguity that I have.

I think that wording should be as:

"So that user agents can avoid retrieving resources for unsupported 
media types, authors may specify media-dependent @import rules. These 
conditional imports specify comma-separated “media queries” after the 
URI. *If user agent makes an attempt to retrieve the CSS resource then 
that UA shall behave as if all rules from that conditionally imported 
CSS sheet are enclosed in correspondent @media section.*

>
>> If you parse them both then each rule shall also contain reference to 
>> media type
>> (or condition expression in case of MQ)
>
> We actually store the media type in the stylesheet, not the rules. So 
> in the screen medium, we wouldn't look at any of the rules of a.css in 
> this example. In the print medium we wouldn't look at any of the rules 
> of b.css.
That are details of particular implementation - UA is free to implement 
this in the way that best suits its architecture.

The only thing that is known for sure is that CSS 2.1 and CSS3 does not 
require conditional imports to be even downloaded
if current media type does not match. If you support, say, only screen 
then you can safely skip even parsing of
@media print { ... } section (with proper {} handling of course). 
Nothing in the spec says that you cannot do that.
On limited devices that is even desired behavior.
>
> (Note: last I checked there were some open questions about what should 
> happen if, say, b.css has an @media block for the print medium, but 
> maybe those have been resolved now.)
Do you know where that resolution would be?
>
>> Am I right in my understanding of how this is going to work?
>
> If you want to think of it that way, you could, I guess...
I guess that reformulation of it as :

p:media( device-width:640 ) {}

defines precisely of how it's intended to be handled in MQs.

>
>> Consider following css resource:
>
> This is the question I refer to in the note above.
>
> -Boris
-- 
Andrew Fedoniouk.

http://terrainformatica.com

Received on Monday, 9 June 2008 22:15:22 UTC