Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modify the top and bottom margin of a printed HTML Page

I am looking to have a 75px margin on the top and bottom of each printed page. I have tried putting the margin on the body and a wrapper div, but both of these options just add a margin to the top and bottom of the whole document. This gives a 75px at the top of the document, then maybe 10px on the top/bottom of the second page, and the last page will have the bottom margin.

I included an image if it will help: http://imgur.com/6tbHzs4

like image 915
Dane Avatar asked Oct 22 '22 02:10

Dane


1 Answers

The other answers are only partially correct. You should use units with a physical dimension (I prefer using pt instead of cm or mm) and you may want to use a print style sheet. But if you want to style the top and bottom margins of a printed page, you will have to also use the @page rule. You probably need something like this:

<style>
@page {
    margin: 75pt 0;
}
</style>
like image 105
Chris Broski Avatar answered Oct 27 '22 18:10

Chris Broski