Created
October 19, 2012 09:40
-
-
Save i-like-robots/3917184 to your computer and use it in GitHub Desktop.
LESS legacy IE transparent background colour
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
.ms-compatible-rgba-bg(@color, @alpha) { | |
// Lacking Sass' 'transparentize' function here =( | |
background-color:rgba( red(@color), green(@color), blue(@color), @alpha); | |
// Less can be very ugly, but using JS parsing is pretty useful | |
@alpha_rgb: 255 * @alpha; | |
@alpha_hex: ~`( parseInt("@{alpha_rgb}", 10)).toString(16)`; | |
@color_str: ~`"@{color}".replace('#', '')`; | |
*zoom:1; | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#@{alpha_hex}@{color_str}, endColorstr=#@{alpha_hex}@{color_str})"; | |
*filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr=#@{alpha_hex}@{color_str}, endColorstr=#@{alpha_hex}@{color_str})"; | |
} | |
.omg-this-works-in-ie { | |
.ms-compatible-rgba-bg(#499EBB, .75); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment