Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compass, SASS, Gradients, and IE? [duplicate]

So according to compass, they only support Chrome, Safari, Firefox 3.6, and Opera when it comes to gradients.

Any ideas on how to add support for IE in compass / some other workaround?

Code in:

  @import "compass";    
   .testgradient {
    @include background(
      linear-gradient(top left, #333, #0c0)
    );
  }

Code out:

.testgradient {

  background: -webkit-gradient(linear, 0% 0%, 100% 100%, color-stop(0%, #333333), color-stop(100%, #00cc00));

  background: -webkit-linear-gradient(top left, #333333, #00cc00);

  background: -moz-linear-gradient(top left, #333333, #00cc00);

  background: -o-linear-gradient(top left, #333333, #00cc00);

  background: linear-gradient(top left, #333333, #00cc00);
}
like image 929
Christopher Dougherty Avatar asked Aug 21 '12 19:08

Christopher Dougherty


2 Answers

For versions of IE before IE10, you'll have to deal with IE's gradient filter.

For IE10 and newer, the unprefixed linear-gradient should work[1]. If you have trouble however, other sites simply use the vendor prefix -ms-linear-gradient. The syntax for both versions is the same as all the other vendor-prefixed gradients.

like image 116
brc Avatar answered Oct 23 '22 21:10

brc


you can simply create your own mixin, so your code would look like that:

@import "compass";    
@mixin myBackground ($direction, $colorList) {
    background: -ms-linear-gradient($direction, $colorList);
    @include background(linear-gradient($direction, $colorList));
}

.testgradient {
    @include myBackground(top left, (#333, #0c0));
}
like image 1
Daniel Meger Avatar answered Oct 23 '22 23:10

Daniel Meger