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

Margin ignored on ul element #2756

Closed
Spreeuw opened this issue Jan 21, 2022 · 4 comments
Closed

Margin ignored on ul element #2756

Spreeuw opened this issue Jan 21, 2022 · 4 comments

Comments

@Spreeuw
Copy link
Contributor

Spreeuw commented Jan 21, 2022

This example shows the top margin of an <ul> element being ignored:

HTML:

<style type="text/css">
	ul {
		display: inline-block;
		list-style: none;
		padding: 0;
		margin: 0;
		margin-top: 10px;
	}

	ul li {
		display: inline-block;
		padding: 0;
		margin: 0;
	}

	ul li strong {
		display: inline-block;
		font-weight: normal;
	}

	ul li p {
		display: inline-block;
		margin: 0;
	}
</style>


<div>
	<span>Biozertifiziert</span> | <span>DE-&Ouml;KO-XXX</span> |
	<ul>
		<li><strong>Variante:</strong> <p>1kg (20% Rabatt)</p></li>
	</ul>
</div>

dompdf-margin-top-dev-master

In 1.0.2 it looked like this:
dompdf-margin-top-1 0 2

Neither situation seems to be rendered the same as Chrome renders the HTML, which simply moves down the entire line when the margin of that <ul> element is increased (rather than moving just the <ul> element itself. So it seems like the top margin was patching a bug to begin with, but now that it's ignored it appears to be even worse than before because it can no longer be controlled via that margin.

Mellthas added a commit that referenced this issue Jan 21, 2022
…ent"

This reverts commit 96a9345. It seems
this was not an innocent fix as it seemed to be. Retain the existing
behavior, which unfortunately undoes the small improvement to #1946.

Fixes #2756
@Mellthas
Copy link
Member

Hm, so the margin has exactly the right value to make the lines aligned in dompdf. The cause of the change is 96a9345, which I thought would be a small, innocent improvement. I think it is best if we revert that for now. Vertical alignment really needs some proper treatment, the current implementation is pretty hackish.

@Mellthas
Copy link
Member

As mentioned in #2757, you can use vertical-align: -10px to achieve the same effect, and it works with current master, too. I think this actually a more appropriate workaround for the misalignment.

@Spreeuw
Copy link
Contributor Author

Spreeuw commented Jan 24, 2022

Thanks for the suggested workaround, that's a good alternative indeed. I agree that changes shouldn't be optimized on workarounds to keep working, and as I wrote above, this was a workaround to begin with...

Neither situation seems to be rendered the same as Chrome renders the HTML, which simply moves down the entire line when the margin of that <ul> element is increased (rather than moving just the <ul> element itself. So it seems like the top margin was patching a bug to begin with

Looking forward to those changes from Brian - if they would result in the behavior being the same as Chrome, that'd be fantastic :)

@Mellthas Mellthas removed this from the 1.2.0 milestone Jan 24, 2022
@Mellthas Mellthas added wontfix and removed bug labels Jan 24, 2022
@bsweeney
Copy link
Member

Should see some improvements with rendering under #2762.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants