Re: [mediaqueries][css-page] MQs should respond to page size

On 04/21/2016 07:28 AM, Florian Rivoal wrote:
> Hi,
>
> (This is listed as Issue 1 in css-page.)
>
> The fact that the width, height, aspect-ratio, and orientation media queries do not respond to page sizes set in @page makes it really hard to do responsive design properly.
>
> If you've designed your page using media queries to work well across a whole range of sizes, and you want to use the size property of @page to pick a size when printing, you're out of luck.
>
> The page will be sized to what you asked, but the size that the
> query will respond to will not be that, but instead the size that
> the page would have had, had you not specified anything. Which is
> totally useless.
>
> We've handled this for @viewport, and we should do it here as well.
>
> The good news is that Chrome (which I believe is the only browser
> to honor @page's size property) already does it, as shown in this
> quick and dirty TC: http://jsbin.com/nabufum

I think it would be great for this to work. It's noted as an issue
in the Paged Media draft:
   http://drafts.csswg.org/css-page/#page-size-prop

What needs to be specified is exactly how it interacts with Media
Queries, since you could have a 'size' declaration inside an MQ
that makes the MQ no longer apply... Currently the Paged Media
spec makes @page { size } within a size-querying MQ effectively
invalid, so that it's possible to make this work. Is this what
Chrome does?

You also need to specify *which* @page 'size' gets applied, if
different pages have different sizes. I think the best thing to
do here is to just take the 'size' declaration in a plain @page.


(Btw, a related issue is having the author specify a series of
preferred sizes, since printers sometimes have more than one size
available.)

~fantasai

Received on Wednesday, 27 April 2016 14:01:13 UTC