Skip to content

Instantly share code, notes, and snippets.

@s9tpepper
Created April 7, 2012 19:17
Show Gist options
  • Save s9tpepper/2331484 to your computer and use it in GitHub Desktop.
Save s9tpepper/2331484 to your computer and use it in GitHub Desktop.
Element Background Opacity w/out affecting children
/* The opacity: .5 CSS property will make the container and its
* children transparent. This LESS mixin can be used to set the
* background-color property with opacity resulting in a transparent
* background color with full opacity children.
*/
.backgroundOpacityRGB(@red: 0, @green: 0, @blue: 0, @bgOpacity: 0.5) {
background: rgb(@red, @green, @blue); // Fallback to full opacity bg
background: rgba(@red, @green, @blue, @bgOpacity); // Alpha'd bg color for 'modern' browsers
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment