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
Extra margins when using inline-block and margin-top #1946
Comments
Re-reading the following issues I realize they are duplicates, or related:
Which issues should be closed as duplicates and which should be kept ? |
Thank you for the analysis. Seems like this might be related to margin collapse not applying to elements correctly. Dompdf right now just looks at immediately siblings and children without regard for display type. |
FYI I'll keep this issue open since the others have long passed their due date and you've taken the time to research things. |
I actually think #500 is a different issue relating to how inline-block elements are flowed to the next line. At any rate, that issue was migrated and there's a recent duplicate so I'll leave it closed. |
#2576 addresses the margins being collapsed with the inline-block children, which resulted in the huge gaps. The remaining issue is the vertical alignment being off for inline-block elements. |
As the margin height is what affects the line-box height. Prevents inline-block frames being pushed out of their line box due to large margins. Partially addresses #1946
As the margin height is what affects the line-box height. Prevents inline-block frames being pushed out of their line box due to large margins. Partially addresses #1946
As the margin height is what affects the line-box height. Prevents inline-block frames being pushed out of their line box due to large margins. Partially addresses #1946
As the margin height is what affects the line-box height. Prevents inline-block frames being pushed out of their line box due to large margins. Partially addresses #1946
As the margin height is what affects the line-box height. Prevents inline-block frames being pushed out of their line box due to large margins. Partially addresses dompdf#1946
The combination of
display: inline-block;
andmargin-top
will mess up the margin of the containing element and each contained element after the first one. That makes it very difficult to have a proper alignment and margin.In my real use-case there is no container, so I cannot apply a padding on the container to workaround this issue. Also
vertical-align: top;
on any elements does not allow to workaround the issue either.Reproducible example
See the code below:
Expected
HTML as rendered by Chrome:
Actual
PDF as rendered by dompdf/dompdf v0.8.3 will show extra margins in different places:
Versions
The text was updated successfully, but these errors were encountered: