Skip to content

Instantly share code, notes, and snippets.

@ajzeigert
Created March 3, 2016 20:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajzeigert/29bba2ed110aa63a8c12 to your computer and use it in GitHub Desktop.
Save ajzeigert/29bba2ed110aa63a8c12 to your computer and use it in GitHub Desktop.
Proper way to embed an SVG with backward compatibility
<!-- Instead of this -->
<img src="path/to/image.svg"/>
<!-- Use this -->
<div style="width:100%;height:100%"> <!-- Vary this according to your needs -->
<object height="100%" width="100%" data="path/to/image.svg" type="image/svg+xml">
<!-- For IE, but will load either way -->
<img src="path/to/image.png"></img>
</object>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment