Skip to content

Instantly share code, notes, and snippets.

@vxhviet
Created January 3, 2019 08:15
Show Gist options
  • Save vxhviet/1dd5265d5ad6eddb935c446697042704 to your computer and use it in GitHub Desktop.
Save vxhviet/1dd5265d5ad6eddb935c446697042704 to your computer and use it in GitHub Desktop.

Scale SVG on Safari

SOURCE, SOURCE

Safari has trouble scaling SVG image so it will distort image if use with attribute like object-fit: cover;. To fix this add preserveAspectRatio="none" to the <svg>:

<svg width="200" height="200" viewBox="0 0 200 200" fill="none" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment