Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

div margins cause bad positioning for vertical-align: bottom in page margin boxes #1886

Open
castedo opened this issue May 24, 2023 · 4 comments
Labels
CSS Questions about how to do something with CSS

Comments

@castedo
Copy link

castedo commented May 24, 2023

Here is a simplified HTML example for what I believe if a bug:
test.html.txt
and the PDF I get with WeasyPrint 58.1:
test.pdf

What I expected is for the pink rectangles in the upper page margin to be positioned similar to the pink rectangles in the lower page margin. In other words, I was expecting the pink rectangles to stay within the blue rectangles.

It seems like the inner div margin handling is correct when the page margin box is vertical-align: top (as seen in the lower page margin) but incorrect when vertical-align:bottom (as seen in the upper page margin).

The height + top + bottom margins of the pink inner divs sum to exactly to the height of the blue page margin boxes. So I see no reason for the pink inner divs to overflow.

Smells like a calculation bug.

@liZe
Copy link
Member

liZe commented May 24, 2023

Surprisingly, Prince gives the same result as WeasyPrint here (except from the widths, because of #58, but that’s another story). So… I’m not sure that it’s a bug. I have to check more precisely the different specifications, and hope to find something on this particular example.

@liZe liZe added the CSS Questions about how to do something with CSS label May 24, 2023
@liZe
Copy link
Member

liZe commented May 29, 2023

Well, Prince and WeasyPrint have the same rendering. AntennaHouse, BFO and Typeset give the "right" rendering. I think that it’s a bug…

The problem seems to be easy to solve, but it’s not: it’s caused by collapsing margins between the running element box and its anonymous wrapper. Fun!

@castedo
Copy link
Author

castedo commented May 29, 2023

Good to know, thank for looking into!

I was wondering how printstrap should handle this issue.

@liZe
Copy link
Member

liZe commented May 30, 2023

I was wondering how printstrap should handle this issue.

We should fix it in WeasyPrint!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Questions about how to do something with CSS
Projects
None yet
Development

No branches or pull requests

2 participants