Full page background with top/bottom spacing

In order to use a full-page background but still have spacing at the top and bottom of the page when text flows from a page to the next, you will need Paged.js and define the following styles:

<!-- HTML Tab -->
<script src="https://cdn.jsdelivr.net/npm/pagedjs@0.4.3/dist/paged.polyfill.js"></script>


/* CSS Tab */

body {
margin: 0;
padding: 0;
background-size: cover;
}

@page {
background-image: url('URL OF YOUR IMAGE');
background-size: cover;
size: 796px 1125px;
margin: 10mm 0;
}


Updated on: 05/05/2025

Was this article helpful?

Share your feedback

Cancel

Thank you!