Skip to content

Instantly share code, notes, and snippets.

@tommymarshall
Created July 5, 2013 22:01
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 tommymarshall/5937523 to your computer and use it in GitHub Desktop.
Save tommymarshall/5937523 to your computer and use it in GitHub Desktop.
Assumes you have a png fallback image of the same name (different extension).
@mixin svg-background($image) {
& {
background-image: image-url("#{$image}.svg");
background-position: top left;
background-repeat: no-repeat;
background-size: contain;
}
.no-svg & {
background-image: image-url("#{$image}.png");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment