Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jstewsy
Created November 3, 2018 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jstewsy/95db554c056a10fdf7d780344cd12acb to your computer and use it in GitHub Desktop.
Save jstewsy/95db554c056a10fdf7d780344cd12acb to your computer and use it in GitHub Desktop.
svg background image scss mixin
/**
* svg-background-image
*
* apply svg/png background-image pattern for IE8 and Android <2.3 support
* uses `linear-gradient` method demostrated here
* https://css-tricks.com/svg-fallbacks/#the-fallbacks
*/
@mixin svg-background-image($image-path: '/', $image-name, $fallback-file-extension: 'png', $repeat: no-repeat) {
background-image: image-url("#{image-path}#{$image-name}.#{$fallback-file-extension}");
background-image: linear-gradient(transparent, transparent), image-url("#{image-path}#{$image-name}.svg"); // scss-lint:disable DuplicateProperty
background-repeat: $repeat;
@content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment