Re: [css3-page][css3-mediaqueries] Page size conflicts

On Feb 20, 2012, at 12:06 AM, Simon Sapin <simon.sapin@kozea.fr> wrote:

> Le 17/02/2012 23:48, fantasai a ¨¦crit :
>> Done.
>>    http://dev.w3.org/csswg/css3-page/#page-size-prop
>>    # If a size property declaration is qualified by a ¡®width¡¯, ¡®height¡¯,
>>    # ¡®device-width¡¯, ¡®device-height¡¯, or ¡®aspect-ratio¡¯ media query [MEDIAQ]
>>    # (or other conditional on the size of the paper), then the declaration
>>    # must be ignored.
> 
> Should orientation and device-aspect-ratio be added to the list?
> 
>> There remains the question of what's possible to do here:
>> 
>>    @page {
>>      size: 4in 6in;
>>    }
>>    @media (max-width: 4in) {
>>      div { background: blue; }
>>    }
>> 
>> Assuming a default paper width>  4in, is the background blue?

I feel that since the above quoted spec text gives precedence to the media query when @page is inside the media query, it would be useful for @page to have precedence when it is outside the media query, thereby overriding whatever the actual physical size of the paper is. So, in this example, the page size is 4in (regardless of actual physical paper size), and the div gets a blue background.

> Nice. What about this one?
> 
>   @page :left {
>     size: 4in 6in;
>   }
>   @page :right {
>     size: 6in 4in;
>   }
>   @media (min-width: 5in) {
>     div { background: blue; }
>   }
>   @media (max-width: 5in) {
>     div { background: red; }
>   }
> 
> 
> Assuming there is a div with a page break, what color is its background? (And what is the computed value of background-color?)

Following the same logic as above, The left page is 4in wide, and the right page is 6in wide. So on the left the div is red, and on the right the div is blue.

Kind of messes with box-decoration-break though, if you had two different background images instead of just background-color.

> And even without page breaks, we only know which page a box is on when doing layout, but the cascade is done much earlier than that.

Is that a problem if done as I describe? Seems no worse than with regions, where you wouldn't know what region an item is in until you do layout. 

> I think the only sensible thing to allow in such media query rules is @page, except for the 'size' property.

Sorry, but my brain doesn't quite parse that sentence. Can you restate it?

Received on Monday, 20 February 2012 19:10:41 UTC