Re: [css3-page][css3-mediaqueries] Changing element styles on page breaks

On 02/21/2012 12:00 AM, Brad Kemper wrote:
>
>
> Sent from my iPad
>
> On Feb 20, 2012, at 6:10 PM, Simon Sapin<simon.sapin@kozea.fr>  wrote:
>
>> Le 21/02/2012 01:44, Simon Sapin a écrit :
>>> I first thought this was a loophole due to unforeseen interactions
>>> between the 'size' property and media queries. But if this is a feature
>>> we want, the behavior need to be spec’ed much more precisely.
>>
>> If styling elements differently on different pages is a feature, going through media queries to do it is quite contrived. I can already see authors doing this:
>>
>>     @page { size: 210mm 297mm }
>>     h1 { page: chapter-title }
>>     /* I don’t really want to change the page size */
>>     @page chapter-title { size: 209.99mm 297mm }
>>     @media print and (width: 209.99mm) {
>>         p { /* Style for text on first page of the chapter */ }
>>     }
>>
>> Why not go all the way and allow full element selectors in @page?
>>
>>     @page { size: 210mm 297mm }
>>     h1 { page: chapter-title }
>>     @page chapter-title {
>>         p { /* Style for text on first page of the chapter */ }
>>     }
>
> Yes, this is precisely what was in mug head that I only recently realized wasn't in the spec.
>
>> The semantics would be similar to regions, but there is a syntax problem to disambiguate @page properties and type selectors.
>>
>> This is a big feature, and I wouldn’t want it to delay what is already in css3-page (especially margin boxes.) So how about this keeping full selectors for level 4?
>
> I don't see how it could be bolted on later without at least making allowances for it now. I don't think you could have 'a:link' (an element and a pseudo-class) in the same place where you could have 'color:green' (a property and value). I think the way to disambiguate would be to not have properties directly within @page, but rather have a selector to set the page box. I think :root could work, but if that is problematic, then maybe just ':page'.

We're already stuck with the current structure of
   @page {
      property: value;
   }
because that's in CSS2.1, and has been implemented in multiple CSS3-Page
implementations. I understand the motivation for wanting page-specific
styling of content, but I think that needs to play into the Regions
proposals; it can't affect the syntax we currently are using for @page
anyway.

~fantasai

Received on Monday, 11 June 2012 19:36:05 UTC