60 Changing Page Margins in PDF Exports

You might want the page margins in your book to be smaller, or larger. You can adjust this using the Custom CSS feature. (Please read this first!).

Changing Margins (Left & Right Pages are the Same)

In your Custom CSS, PDF version, add the following to define your page margins. For instance, if you want to make your top and bottom margins 2in, and your side margins 1.5in, you would add the following code:


@page {
  margin-top: 2in !important;
  margin-bottom: 2in !important;
  margin-left: 1.5in !important;
  margin-right: 1.5in !important; 
}

NOTE: the !important is … important. It makes sure your settings override what Pressbooks sets as page size.

Changing Margins (Left & Right Pages are Different)

You may want your left and right pages (recto/verso) to have different margins, so that for instance the outside margins are wide, and the inside margins are tighter. In this case you would add the following:


@page:left {
  margin-top: 2in !important;
  margin-bottom: 2in !important;
  margin-left: 3.5in !important;
  margin-right: 1.5in !important; 
}

@page:right {
  margin-top: 2in !important;
  margin-bottom: 2in !important;
  margin-left: 1.5in !important;
  margin-right: 3.5in !important; 
}

NOTE: We have recently introduced a new method for setting custom margins in select themes. For more, see our guide chapter on the changes.

License

Icon for the Creative Commons Attribution 4.0 International License

University of Florida Pressbooks User Guide Copyright © 2012 by Book Oven Inc. (Pressbooks.com) is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.

Share This Book