Forum How do I...?

Height of Header and Footer

mong
How do I set the height of the header and footer?
I've tried:

@page {
size A4;
@top-left { height: 10pt; }
}

but it doesn't work.

Mong
mikeday
Looks like my original reply was lost due to server maintenance, so I'll repeat it. The height of the headers/footers depends on the height of the page margin boxes, which can be specified like this:
@page {
    margin-top: 10pt;
    margin-bottom: 20pt
}
nbrouard
Yes, thank you. Very important feature if you want to print a book, for example on lulu.com, because your text and mostly important your headers (and footers) have to be to a certain distance from the edge. And if in the preview of your book, you see that your header is shaded, you have to increase its height by using the margin-top.
But in that case, there is a too big vertical space between the header line and your text (same thing on the footers). And it comes from the fact that your header text line is vertically centered within this increased vertical space..

Therefore you can add something like (in your @top, @top-left and @top-right) vertical-align: bottom; and you will understand how the margin-top is important.
Now, you can reduce your margin-top by half for example, but your main text will then be too close to your heading and here comes the effect of the padding-bottom which should be increased to move your text as it was before adding the vertical-align: bottom; . Here is an example:
@page {
   @top {vertical-align: bottom;}

   /* margin: 2.6cm 1.25cm 2.6cm 1.25cm;*/ 
   /* top right bottom left before vertical-align: bottom */
              margin: 1.5cm 1.25cm 1.5cm 1.25cm; 
              /* with vertical-align: bottom */

	      padding-bottom: 1em; /* 1em=0.423cm */
	      padding-top: 1em;
    @bottom {vertical-align: top;}
}