Re: [css3-page] Styling elements differently based on whether they appear on a left or right page

On Sun, Sep 1, 2013 at 7:25 PM, Alan Stearns <stearns@adobe.com> wrote:
> On 9/1/13 3:24 PM, "Lea Verou" <lea@verou.me> wrote:
>>Another issue I see that hasn't been discussed much in this thread is
>>fragmentation. How are the rules applied if an element spreads across
>>multiple pages? Ideally each rule would apply only to the fragment of the
>>element in the targeted page, but I can see how that might be difficult
>>to spec and/or implement. In that case, we could define it so that the
>>rules apply to the entire element, based on which page its first fragment
>>is on. Then authors could make sure that these elements don¹t span
>>multiple pages if this behavior is undesirable (for example, you usually
>>don't want sidebar blocks to span multiple pages anyway).
>
> There are plenty of examples of sidebars spanning multiple pages in print.
> In paginated views, it's impossible to make sure elements don't span pages
> when you can't control the size of the page. I think dealing with the
> complexities of styling fragments of elements is necessary.

>From what I can tell, the problem of styling things in pages is
approximately identical to the problem of styling things in regions,
no?  We should just be able to define a general spec mechanism for
styling information coming from multiple sources other than your
parent, and then just have an appropriate grammar for pages.

For the grammar, regions now just uses a normal selector to select the
region container, a ::region pseudo-element to switch into its "region
context", then another normal selector to select within this context.
Pages need to start from an @page rule, but we don't have arbitrary
selects on the left, just a single compound selector.  We could do
something as simple as:

@page :left p { color: black; }
@page :right p { color: blue; }

That is, just allow complex selectors in @page, with the first
compound selector applying to the page, and the rest applying to the
elements in that page context.  Since pages just receive a subset of
the properties that elements do, this doesn't even have any weird
context-mixing issues.

Using the generic style-block nesting mechanism (whatever it is) would
then let you style multiple things without having to retype "@page
foo" over and over again.

~TJ

Received on Tuesday, 3 September 2013 17:16:53 UTC