Skip to content

Instantly share code, notes, and snippets.

@rheaton
Created June 25, 2013 18:48
Show Gist options
  • Save rheaton/5861191 to your computer and use it in GitHub Desktop.
Save rheaton/5861191 to your computer and use it in GitHub Desktop.
background-size mixin using IE8 polyfill
@mixin ftm-background-size($background-size-value: contain, $background-size-value-y: 100%) {
$cover-or-contain: ($background-size-value == contain) or ($background-size-value == cover);
@if $cover-or-contain {
background-size: $background-size-value;
-webkit-background-size: $background-size-value;/* Safari 3.0 */
-moz-background-size: $background-size-value; /* Gecko 1.9.2 (Firefox 3.6) */
-o-background-size: $background-size-value; /* Opera 9.5 */
} @else {
background-size: $background-size-value $background-size-value-y;
-webkit-background-size: $background-size-value $background-size-value-y;/* Safari 3.0 */
-moz-background-size: $background-size-value $background-size-value-y; /* Gecko 1.9.2 (Firefox 3.6) */
-o-background-size: $background-size-value $background-size-value-y; /* Opera 9.5 */
}
-ms-behavior: url(/assets/background_size/backgroundsize.htc);
// add support for IE8
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment