Re: [css3-page] Modifying other CSS rules with :left and :right

On 01/20/2015 09:02 PM, David Gatwood wrote:
>
> It recently struck me that one limitation of CSS when compared with other typesetting systems is the ability to control the
> alignment of content based on whether it falls on a left or right page. A common trick in print publishing is to make certain
> content (e.g. chapter numbers) be right-justified when it appears on a right-hand page, and left-justified when it appears on
> a left-hand page so that the content is always near the outer margin.  The "@page :right" mechanism seems like an ideal way to
> solve that problem, and for a very limited subset of cases (page headings), it can actually do that, but for other content, it
> currently can't.
>
> I read a comment that you're planning on adding "inner" and "outer" values to the float property, and that's a good start, but
> that doesn't fully solve the problem.  After all, most of the time, you'll also want to change the alignment of text within
> those boxes, change the margins to favor the opposite side, and so on.
>
> It would be immensely helpful if the @page mechanism allowed you to specify additional style rules that apply to specific
> elements (or to line boxes within specific block elements) that fall on a particular page—in particular, the ability to alter
> the text-align, left margin, right margin, left padding, right padding, and possibly float properties, e.g.
>
>      @page :left {
>           ...
>           @page-content-rules {
>                .outeralignbox { float:left; text-align: left; margin-left: .5em; margin-right: 3em; }
>           }
> }
>      @page :right {
>           ...
>           @page-content-rules {
>                .outeralignbox { float:right; text-align: right; margin-left: 3em; margin-right: .5em; }
>           }
> }
>
> Alternatively, adding left-page and right-page pseudoclasses that can apply to any selector could serve the same purpose, e.g.
>
> .outeralignbox:left-page { float:left; text-align: left; margin-left: .5em; margin-right: 3em; }
> .outeralignbox:right-page { float:right; text-align: right; margin-left: 3em; margin-right: .5em; }
>
> Obviously, there are some practical concerns with either approach, such as how to handle rules that would cause the content to
> move to another page, so supporting even the limited subset of properties above isn't necessarily a trivial change.  However,
> it would go a long way towards making EPUB capable of accurately replicating print books.
>
>
> Thoughts?

We've got vague plans to do that, yeah. See the big red issue at
   http://dev.w3.org/csswg/css-scoping/#the-region-pseudo-element
Basically we've got the same problem in a number of places, and
should solve them all the same way.

Hasn't been a super-high priority, so there isn't really a spec
for it yet. But hopefully someday. :)

~fantasai

Received on Wednesday, 21 January 2015 09:38:28 UTC