Skip to content

Instantly share code, notes, and snippets.

@xbill82
Last active August 29, 2015 13:56
Show Gist options
  • Save xbill82/8800675 to your computer and use it in GitHub Desktop.
Save xbill82/8800675 to your computer and use it in GitHub Desktop.
LESS background alpha Mixin
// --- Cross-browser transparent background trick thanks to
// http://hammerspace.co.uk/2011/10/cross-browser-alpha-transparent-background-css
.bg-alpha(@color, @opacity) {
@alphaColour: hsla(hue(@color), saturation(@color), lightness(@color), @opacity);
@ieAlphaColour: argb(@alphaColour);
background:@color;
background: transparent\9;
background: rgba(red(@color), green(@color), blue(@color), @opacity);
filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d',endColorstr='%d')", @ieAlphaColour, @ieAlphaColour));
zoom: 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment