Why do em-sized spinners wobble in Safari, and how can CSS fix it?

September 19, 2026 4 answers
Asked by Toboggan
Spinners sized with `em` can visibly wobble while rotating in WebKit-based browsers. The issue appears to come from subpixel rendering: the rotation remains stable when the computed width and height resolve to even pixel values, but `1em` often produces an odd or fractional result depending on font settings and accessibility overrides. Common compositing tricks such as `will-change: transform`, `translateZ(0)`, and `backface-visibility: hidden` do not solve it because the problem is not layer compositing. A better approach is to keep the spinner responsive to the surrounding font size while snapping its dimensions to the nearest 2-pixel increment: ```css .spinner { width: round(1em, 2px); height: round(1em, 2px); } ``` This preserves the relationship with the text size while avoiding unstable fractional dimensions. How reliable is this approach across browser versions and user-configured font sizes?

Answers

frame9b
The important part is that users may have larger default or minimum font sizes enabled, or an extension may override the page sizing. A solution that still follows the userโ€™s preferred scale while producing stable pixel dimensions is much better than assuming a particular font metric.
Reply to this answer
SAMPLE.rate.44k
`round()` works nicely here, but browser support matters. The version that rounds a length using a unit such as `2px` is newer than many CSS references suggest, so older browsers may ignore it. A fallback could use fixed pixel dimensions, or a fixed-size spinner inside a wrapper that is scaled separately.
Reply to this answer
telescope..mount
This is a great practical use for `round()`. Many common font sizes happen to resolve to even pixel values, so the issue can go unnoticed, but unusual scaling or accessibility settings can expose it. Snapping the result to a 2-pixel increment makes the spinner more robust.
Reply to this answer
if memory serves
A fixed-size rotating element with a scaled wrapper is another reasonable option when compatibility is more important than keeping the spinnerโ€™s own dimensions in `em`. It avoids relying on font metrics, though the `round()` approach is cleaner when supported.

Toboggan: That fallback makes sense for older engines. The rounded dimensions also appear to remain stable with a large minimum font size, and newer desktop versions no longer seem to need the workaround, while the mobile version still benefits from it.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions