W3C home > Mailing lists > Public > www-style@w3.org > March 2012

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

From: Simon Sapin <simon.sapin@kozea.fr>
Date: Wed, 07 Mar 2012 13:49:48 +0100
Message-ID: <4F57596C.7050102@kozea.fr>
To: fantasai <fantasai.lists@inkedblade.net>
CC: www-style@w3.org
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.
>
> 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?


It turns out I had missed a sentence just after the quoted change:

> Media queries do not honor ‘size’: they assume the paper size that
> would be chosen if no @page rules were specified.

So the rest of my messages in this thread are based on a misunderstanding.

With that in mind, Paged Media *is* consistent with Media Queries. 
(Stylesheets never influence how media queries are evaluated.)

Media queries are based on the default page size which, in Paged Media 
terms, is the used value for @page { size: auto }

Assuming that the default size is wider than 4in then no, the background 
is not blue in the above example. The media query evaluates to false.

So the problem is that this can be surprising for authors. Page 
size-based media queries only make sense if the 'size' property is not 
used at all in the document (or in ignored declarations). This also goes 
for the examples in 8.1.2 of Paged Media.

I guess the best we can do is to add warnings about this in both specs.

-- 
Simon Sapin
Received on Wednesday, 7 March 2012 12:50:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 03:48:51 GMT