Skip to content

Instantly share code, notes, and snippets.

@Daniel15
Created April 29, 2012 10:32
Show Gist options
  • Save Daniel15/2549243 to your computer and use it in GitHub Desktop.
Save Daniel15/2549243 to your computer and use it in GitHub Desktop.
LESS mixin for RGBA colours in IE
// Use with colour name: .rgba(black, 0.5) or hex value: .rgba(#FF2400, 0.5)
.rgba(@colour, @alpha)
{
@alphaColour: hsla(hue(@colour), saturation(@colour), lightness(@colour), @alpha);
@ieAlphaColour: argb(@alphaColour);
background-color: @colour; // Fallback for older browsers
background-color: @alphaColour;
// IE hacks
zoom: 1; // hasLayout
background-color: transparent\9;
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=@{ieAlphaColour}, endColorstr=@{ieAlphaColour})"; // IE 8+
filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr=@{ieAlphaColour}, endColorstr=@{ieAlphaColour})"; // IE 6 & 7
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment