Forum How do I...?

Two lines in header

lindm
Is i possible to have a header containing two lines?

Have tried <br> in the header but no go.
mikeday
You can use a CSS character escape for line-feed, like this:
@page {
    @top {
        content: "Hello\a world!";
        white-space: pre
    }
}

The white-space property will ensure that the line-feed character generates an actual line break and is not collapsed away.
lindm
Great! Do you know how I can use the string set property to get two lines from the document? Let's say I have the following code in my html doc to use

<h1>Hello1 <br> Hello2</h2>

This shows the <br> in text when using the string set property.


@page { 
    @top {
	content: string(doctitle)
    }
}

h1 { string-set: doctitle content() }
mikeday
The string-set property will only capture the text content of the element, and as the <br> element has no text content it won't cause a line break. It might be easier for you to use the flow mechanism described here to take an entire element from the document, with its style preserved intact.
rolandw
I am attempting to use two flows in my document.


@page {size: A4; margin: 14mm 12.5mm 15mm 10mm;
@top {content: flow(header);}	
}

@page:first {
@bottom-left {content:  flow(footer); font: normal 7pt/9pt sans-serif;	margin-left: 2cm;}
}


I then have two divs, one for the header (div id="docheader") and one for the footer (div id="docfooter") and corresponding values in the css:

#docheader {flow: static(header);}
#docfooter {flow: static(footer);}


Bizarrly the footer works everytime, the header rarely. If I change the flow and put the content of the top to footer then that works but I never get to see header...

If I use h1 as the element for header then all works fine...

I'm rather struggling with the definition of a "bloc level element" as per the documentation. What do I have to do to a normal div to get its flow to work correctly? Clearly I'm missing something! Any advice on this would be much appreciated!
mikeday
That looks fine, a block level element is just a <div> for example, not an inline element like <span>. If you're still having trouble with it, email me a sample document and I'll take a look.