Re: Printing a Book with CSS

Also sprach Lachlan Hunt:

 > > For example, the Table of Contents uses leaders and generated page 
 > > numbers:
 > > 
 > >    Introduction...................12
 > >    HTML...........................15
 > 
 > I looked for documentation of the leader() function in Prince's 
 > documentation, but I couldn't find it mentioned anywhere.  Is there any 
 > documentation for it?

This is experimental stuff which could be changed on short notice so
it makes sens to not document it now. I believe, however, that this is
how it works:

  A new value, 'leader()' is allowed on the 'content' property. The
  functional notation accepts a string value, e.g.:

    leaders(' . ')

  In its simplest form, the 'content' property only takes a 'leaders' value:

    hr { content: leaders(' . ') }

  In a more complex example, the 'leaders' value is combined with other
  values on the 'content' property:

    ul.toc a::after {
      content: leader(' . ') target-counter(attr(href), page);
    }

  If there are more than one 'leaders' value, the available space on
  that line will be split equally between them so that the line is
  filled. 

  This way, you can pseudo-center content using leaders:

    h1:before { leader(' ') }
    h1:after { leader(' ') }

  If the leader pattern is specified as a string, the full string must
  be displayed. This way, it is possible to set a minimum length for
  leaders:

    ul.toc a::after {
      content: leaders('....') target-counter(attr(href), page);
    }

I attach a file with some examples. You will need Prince to see the
intended effects:

  www.princexml.com

(Apparently, the Prince server was overloaded by download requests as
a result of yesterday's article. If you didn't succeed downloading
yesterday, you may want to try again.)

-h&kon

[Disclosure: I'm on the board of YesLogic, the maker of Prince]

Received on Wednesday, 30 November 2005 11:07:39 UTC