Prevent SVG Distortion in CSS Grid

Keep aspect in a grid cell with meet + justify-self/align-self center — not a gradient fix

Fix flexbox stretch? Fix flexbox stretchMake responsive? Make responsive

FAQ

Quick answers

Why does CSS grid distort my SVG?
A 1fr cell with both axes stretched can force the SVG box. This tool sets meet and centers the item so the cell no longer squash-scales the art.
How is grid distortion different from flexbox stretching?
Grid uses tracks and justify-self/align-self. Flexbox uses flex-shrink. Use the matching page for the parent you actually have.
Does prevent-distortion change gradientUnits?
No. For objectBoundingBox gradients in a grid, use Fix SVG Gradient Stretch in CSS Grid.
Can I still fill the cell without distortion?
Yes — meet letterboxes. Slice would crop. This page chooses meet so nothing is clipped.
Fix flexbox stretch → Make responsive → Scale with container →
Open full editor →

Source

Type or paste SVG markup. The preview on the right updates as you type.

Ready

Live preview

PNG export · 2× for retina