How to keep rectangular icons from stretching in square tiles
Answer in brief
Give the tile explicit dimensions and apply object-fit: contain to the image when its whole silhouette matters. The image can then occupy part of the square without changing its proportions.
Fit a wide delivery truck
A 120 by 60 truck in a 48-pixel square renders as 48 by 24 under contain. Center it and inspect the wheels. Elliptical wheels suggest that a sizing rule stretched the artwork.
Check whether cropping is acceptable
Try cover on a duplicate of the truck tile. In the square tile, the wide truck scales until its height fills the frame and the sides extend outside it. A background texture may tolerate that crop. A delivery truck that loses its cab has lost the feature that distinguishes it from a trailer.
Sources
- [1] object-fit CSS property - CSS — MDN Web Docs, accessed November 23, 2026
Frequently asked questions
Why is there still empty space?
Some space follows from the aspect ratios. Transparent pixels inside the source can add further space. Inspect the export bounds before adjusting CSS.