Skip to content

Instantly share code, notes, and snippets.

@frankyonnetti
Created May 23, 2021 20:36
Show Gist options
  • Save frankyonnetti/5cf23155f5e8d86df160859319daf292 to your computer and use it in GitHub Desktop.
Save frankyonnetti/5cf23155f5e8d86df160859319daf292 to your computer and use it in GitHub Desktop.
SVG - in html #svg
<!-- object embed -->
<object data="your.svg" type="image/svg+xml">
<img src="yourfallback.jpg" />
</object>
<!-- img tag -->
<img src="your.svg" onerror="this.src='your.png'">
<!-- css -->
div {
background-image: url(fallback.png);
background-image: url(your.svg), none;
}
<!--
Or simply paste the SVG xml into the HTML.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment