Skip to content

Use padding instead of margin - #357

Closed
jared-hughes wants to merge 2 commits into
mainfrom
padding-not-margin
Closed

Use padding instead of margin#357
jared-hughes wants to merge 2 commits into
mainfrom
padding-not-margin

Conversation

@jared-hughes

@jared-hughes jared-hughes commented Aug 5, 2026

Copy link
Copy Markdown

On Safari, an inline-block parent containing a bunch of inline-block children gets its size over-estimated slightly, likely due to subpixel rounding. E.g. https://jsfiddle.net/Ld09ex1q/.

This PR switches the uses of margin on digits to padding, since it doesn't have that problem on Safari. It still uses display: inline-block though, so the performance on Chrome is still good. This gets us into a good place in all the rendering engines without needing any feature detection.

This isn't just a trivial replacement, since padding cannot be negative. Requires the transform approach.

To avoid pixel rounding in WebKit.
It's still slightly off in Chrome.
@jared-hughes

Copy link
Copy Markdown
Author

Closing in favor of #358

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant