Forum Bugs

Formatting a div which crosses page boundaries

SimonBrooke
I don't know whether this is a bug, or this is what the specification requires, but it isn't what I want...

I have a document divided into chapters with <div class="chapter">; and then the chapters further subdivided into 'scenes' with <div class="scene">. I want to show a fine black line between scenes. So I've tried:

/* in addition to Hakon Lie's suggestions I propose that a chapter is
* divided into one or more subdivisions called scenes */

div.scene
{
border-bottom: 1pt solid black;
padding-top: 0.6em;
padding-bottom: 1em;
}


The problem I've got is that if I put the solid border on the bottom of the div (as above) I get a black line at the foot of each page the div spans, as well as at the end of the div. If I instead use 'border-top: 1pt solid black;' I get a black line at the top of every page the div spans. I don't want the lines at either the top or the bottom of the page, just at the end of the div.

Is prince's behaviour correct here? If it is correct, are there any suggestions as to how to achieve the effect I want?

Related point: I'm using
border: 1pt solid black;

rather than
border: thin solid black;
because the 'thin' line isn't very thin. But actually the '1pt' line isn't very thin either - certainly considerably more than 1 point. What is the best way of getting a genuinely thin line?

Very exciting technology, by the way; congratulations.
mikeday
In the future, Prince will support a CSS3 property allowing user control of whether borders should be repeated when a block is split across more than one page. For now, you can place a line between scenes using generated content like this:
div.scene::after {
    display: block;
    content: "";
    border-top: solid black thin
}

This will add an empty block with a top border after each scene, which will appear only once.

With regards to the line thickness, a 1pt line should really be only 1pt thick. However, how it looks when the PDF is viewed on a screen depends on how the PDF viewer chooses to render it. Often, lines that are actually thinner than a single pixel on the screen are rendered thicker than they should be. This can be revealed by zooming in, or by printing out the PDF on paper.
SimonBrooke
Thanks, that does exactly what I want.

This really is very nice. One sed script, one XSL file, one CSS file, and I'm converting masses of legacy documents into nice, consistently formatted printable texts.

Congratulations again.