Skip to content

Instantly share code, notes, and snippets.

@jgv
Last active March 26, 2017 21:42
Show Gist options
  • Save jgv/745754 to your computer and use it in GitHub Desktop.
Save jgv/745754 to your computer and use it in GitHub Desktop.
Cross-browser sass/scss mixin for opacity down to IE 5
@mixin hp-opacity($trans) {
filter: alpha(opactiy=($trans * 100));
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=#{$trans * 100})";
-moz-opacity: $trans;
-khtml-opacity: $trans;
opacity: $trans;
}
@worthers
Copy link

Typo in -ms-filter Opactiy => Opacity

@worthers
Copy link

Ooh, and in filter

@jgv
Copy link
Author

jgv commented Apr 30, 2013

@worthers thanks, fixed

@adriantoine
Copy link

Typo in filter 'opactiy' => 'opacity', not fixed

@meilinger
Copy link

Also, the "filter" line should be after "-ms-filter" to support IE8 in IE7 rendering mode. Syntax issue prevents the calculation correctly for the "filter" line, should be: "filter: alpha(opacity=#{$trans * 100});"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment