Open sebastien-coavoux opened 1 month ago
Hi!
That’s because col-*-*
elements have position: relative
set. According to the specification, break-after
can break-before
can only be set on "boxes in the normal flow of the fragmentation root", and that’s not the case for blocks with relative position.
Well, it may be more complicated than that, relative
is not absolute
or fixed
, and relative elements are actually in the flow.
It’s actually because it’s float: left
, and we don’t break on floating elements. We should though: "User agents should also apply these properties to floated boxes whose containing block is in the normal flow of the root fragmented element."
Short sample to reproduce the problem:
<div style="break-after: page; float: left">float</div>
<div>end</div>
Hi,
I noticed that weasyprint does not honor the page break attributes when generating a pdf. Looks like a bug to me as it happens with a specific mix of div / css . See example below :
index.html
merged-css.txt
You should see no page break, and everything in the same pdf page.
I'm not a css guy, the file comes from a merge of bootstrap and other css files. I did not write them.
I noticed 2 things :
col-xs-12
andcol-sm-8
on the line 5 (where the page break is). It worksrow clearfix layout layout-left
div scope. It works.It is weird to me because all those classes don't mention page break avoid (even if there are page break avoid in the css).
Let me know if you see some obvious workaround for me. The html is generated but I can change the text inside the div (" IN DIV page break at end"). As of now I use the print to pdf from firefox that works, but not very fun to automate.
Thanks