Skip to content

Instantly share code, notes, and snippets.

@patrykgruszka
Created May 5, 2017 20:43
Show Gist options
  • Save patrykgruszka/db35f42374ec1e05be4ab994b8e1ccc0 to your computer and use it in GitHub Desktop.
Save patrykgruszka/db35f42374ec1e05be4ab994b8e1ccc0 to your computer and use it in GitHub Desktop.
Scss mixin for responsive backgrounds (Bootstrap 3)
@mixin responsive-background($img: 'img', $ext: 'jpg') {
background-image: url("#{$img}-xs.#{$ext}");
@media(min-width: $screen-sm-min) {
background-image: url("#{$img}-sm.#{$ext}");
}
@media(min-width: $screen-md-min) {
background-image: url("#{$img}-md.#{$ext}");
}
@media(min-width: $screen-lg-min) {
background-image: url("#{$img}-lg.#{$ext}");
}
@media(min-width: 1600px) {
background-image: url("#{$img}-xl.#{$ext}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment