-
-
Save thom4parisot/5860036 to your computer and use it in GitHub Desktop.
Horizontal Gradient Sass Mixin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin horizontal-gradient($from, $to, $stop: 100%) { | |
/* fallback/image non-cover color */ | |
background-color: $from; | |
/* Firefox 3.6+ */ | |
background-image: -moz-linear-gradient(left, $from 0%, $to $stop); | |
/* Safari 4+, Chrome 1+ */ | |
background-image: -webkit-gradient(linear, left top, right top, color-stop(0%, $from), color-stop($stop, $to)); | |
/* Safari 5.1+, Chrome 10+ */ | |
background-image: -webkit-linear-gradient(left, $from 0%, $to $stop); | |
/* Opera 11.10+ */ | |
background-image: -o-linear-gradient(left, $from 0%, $to $stop); | |
/* IE10+ */ | |
background: -ms-linear-gradient(left, $from 0%, $to $stop); | |
/* Standard */ | |
background: linear-gradient(to right, $from 0%, $to $stop); | |
/* IE6-9 */ | |
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='$from', endColorstr='$to',GradientType=1 ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.my_div { | |
@include horizontal-gradient(white, transparent); | |
} |
nice! Thanks
Didn't work for IE6-9,
.my_div {
@include horizontal-gradient(#71c005, #88dd06);
}
outputs...
.my_div {
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='$from', endColorstr='$to',GradientType=1 );
}
for those following, try
.my_div {
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#{$from}', endColorstr='#{$to}',GradientType=1 );
}
Thanks for the snippet!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍