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

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

From: Brad Kemper <brad.kemper@gmail.com>
Date: Fri, 15 Jun 2012 20:07:41 -0700
Cc: www-style@w3.org
Message-Id: <B0344561-5A2B-446E-8C7A-C53BB25FC1C9@gmail.com>
To: fantasai <fantasai.lists@inkedblade.net>
OK.

So, if I wanted to add @regions to the inside of an @page, then that is doable, right? Image this:

@region normally requires a selector to select a region, so it can style the part of the flow within the region.[1] Presumably (although the spec doesn't say) using an @region selector to select something that is not a region has no effect. But I can imagine selecting @region :root, or not having any selector at all after @region, would cause @region to just select the entire "normal" (non-named) flow (the stuff that isn't in a named region flow). Normally, doing so for continuous media wouldn't be terribly useful, but put '@region { … }' inside of '@page thisParticularPage { … }', and then the rules inside that @region would apply to only that page. 

I think that would about cover it, no? Can we add that to the region spec? 


1) http://dev.w3.org/csswg/css3-regions/#the-at-region-style-rule

On Jun 11, 2012, at 12:33 PM, fantasai wrote:

> 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 Saturday, 16 June 2012 03:08:15 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:55 GMT