Skip to content

Instantly share code, notes, and snippets.

@alanshaw
Created May 9, 2012 12:35
Show Gist options
  • Save alanshaw/2644213 to your computer and use it in GitHub Desktop.
Save alanshaw/2644213 to your computer and use it in GitHub Desktop.
LESS CSS class for cross browser opacity
.opacity(@opacity) {
@ieOpacity: @opacity * 100;
// If you don't use this order, IE8-as-IE7 doesn't apply the opacity, although IE8 and a pure IE7 do.
// http://www.quirksmode.org/css/opacity.html
-ms-filter: ~"progid:DXImageTransform.Microsoft.Alpha(Opacity=@{ieOpacity})"; // IE 8
filter: ~"alpha(opacity=@{ieOpacity})"; // IE 5-7
opacity: @opacity;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment