SASS rgba gradients

Here's a SASS snippet for making cross browser rgba gradients. This example uses three color stops but 2 or more can be used. Also, the example gradient is vertical, read the external references for options to make the gradient go in any direction.

$color_start: rgba(red, 1);
$color_mid: rgba(#456789, .8);
$color_stop: rgba($examplecolor, 0);
@include background(filter-gradient(ie-hex-str($color_start), ie-hex-str($color_mid), ie-hex-str($color_stop))); // For IE
@include background(linear-gradient($color_start, $color_mid, $color_stop));

Tags

External References

Article Type

General