Skip to main content
User avatar

page-break-before:always breaks the pdf?

As part of my quest to get bigger images, I'm getting some weird page breaks.

Block Image

I tried simply adding

h3.stepTitle {

page-break-before: always;


But the pdf generation fails. HTML looks fine.


Some overlapping page-break-inside: avoid maybe?

Answered! View the answer I have this problem too

Is this a good question?

Score 1
Add a comment

1 Answer

Chosen Solution
User avatar

Looks like you'll have to max out your .stepImages elements width (which, in turn, will limit their corresponding heights) at 401px in order to fit three images on the same page.

There are a ton of page-break-inside and page-break-after rules which makes the exact logic hard to follow. If you're really interested in squeezing every little pixel of height out of your images maybe try multiple columns as I think the issue is your .stepText rules are kicking in and thereby causing some of those page-break rules which is in turn causing your step title to get bumped up to the previous page.

Was this answer helpful?

Score 1



The issue was not to fit three images on one page however.

It was to fit the Title with the first image (and then the last image possibly overflowing.)

I'll compromise it together with your 2nd suggestion pdf Custom CSS - howto make all images same size?

and be done with it for now.

Thanks for the insight.


Add a comment

Add your answer

Author avatar Filip Goc will be eternally grateful.