Skip to content

Instantly share code, notes, and snippets.

@fieldoffice
Created September 23, 2014 12:51
Show Gist options
  • Save fieldoffice/c32460b6f0b115fad634 to your computer and use it in GitHub Desktop.
Save fieldoffice/c32460b6f0b115fad634 to your computer and use it in GitHub Desktop.
Sass Background Gradient Mixin
@mixin background-gradient($startColor, $endColor) {
background: $startColor; /* Old browsers */
background: -moz-linear-gradient(top, $startColor 0%, $endColor 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,$startColor), color-stop(100%,$endColor)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, $startColor 0%,$endColor 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, $startColor 0%,$endColor 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, $startColor 0%,$endColor 100%); /* IE10+ */
background: linear-gradient(to bottom, $startColor 0%,$endColor 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='$startColor', endColorstr='$endColor',GradientType=0 ); /* IE6-8 */
}
@include background-gradient($startColor, $endColor);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment