Hello everyone, I'm currently experiencing an issue with my print media CSS. On the HTML page, there are two main divs - one for the body and one for the footer.
<div class="main-template-body" id="main-template-body">
//content
</div>
<div class="main-template-footer">
//footer
</div>
When printing the webpage, I want the footer to be fixed at the bottom of every page. I have successfully achieved this using the following CSS:
.main-template-footer {
display:block;
position:fixed;
bottom:0;
width:100%;
min-height:50px;
height:auto;
}
For the body part, I tried using margin-bottom in order to set a margin between the body and the bottom border of the printed page to prevent overlap with the footer, but it didn't work as expected.
.main-template-body {
width:100%;
height:auto;
display:block;
position:relative;
//margin-bottom: 20px; tried
//margin-bottom : 2cm; also tried this
}
My question is, how can I set a margin between the 'main-template-body' div and the bottom border of the print page to avoid overlapping with the footer?
The current CSS is applying the margin to both the body and the footer:
@page {
margin-bottom: 4cm;//<- How to set this margin to specific div only?
}
Thank you all in advance.
Edit: Below are images of two pages where on the first page there is an overlap between the footer and content, with the content continuing onto the second page. I need to set a margin to the content to prevent this overlap from happening.