For an example that can be replicated, check out this link -
https://cbbanalytics.com/stats/27694/games/1864019/overview
. We have applied a CSS style of page-break-before: always
to the <h3>
element containing the Stanford logo and text Stanford Team Shot Charts
, using the class print-break
. The purpose of this is to ensure a clean PDF output when printing or saving.
https://i.sstatic.net/gG1Do.png
. . .
However, when printing or saving as a PDF, despite the page break functioning correctly, there is an additional whitespace above the <h3>
element on the second page. The cause of this extra space remains unknown...
https://i.sstatic.net/uJF7C.png
. . .
Upon entering print preview mode following the steps outlined here, no such white space appears in the browser above the header or below the tables.
https://i.sstatic.net/LT2Ys.png
.
.
.
Please note that the empty div
with margin-top: 60px
just above the <h3
> element is hidden when printed (using the hide-print
class which sets display: none
for printing). Removing this div
does not resolve the issue of the mysterious white space above the page break. What else could be causing this problem? It significantly impacts the appearance of the printed or saved PDF.
UPDATE: Deleting the element with the controller-navbar-container
class (the red bar at the top displaying team names & logos) resolves the page break issue. However, the reason behind this solution remains unclear. Why does this element influence the page break behavior?