Forcing content to fit on a single page

Forcing content to fit on a single page


If you want to make a container that will always take an entire page, no more, no less, you can define it like so:


:
.page {
/* Defining an A4 portrait page */
height: 1120px;
width: 793px;

/* Will prevent any content like large images from messing */
/* with printed content auto-scaling */
overflow: hidden;

/* Will allow any absolutely positionned content to be */
/* placed relatilvely to the page by default */
position: relative;
}


:
<div class="page">
Content for a single page
</div>

Updated on: 16/08/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!