Skip to content

Instantly share code, notes, and snippets.

@philippbosch
Created July 19, 2010 10:49
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save philippbosch/481261 to your computer and use it in GitHub Desktop.
Save philippbosch/481261 to your computer and use it in GitHub Desktop.
image-less RGBA backgrounds for real browsers and Internet Explorer
@mixin rgba-background($color, $opacity) {
background-color: $color;
background-color: rgba($color, $opacity);
background-color: transparent\9;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#{'#'+hex(round($opacity*255)) + '' + hex(red($color)) + '' + hex(green($color)) + '' + hex(blue($color))},endColorstr=#{'#'+hex(round($opacity*255)) + '' + hex(red($color)) + '' + hex(green($color)) + '' + hex(blue($color))});
zoom: 1;
}
module Sass::Script::Functions
def hex(decimal)
Sass::Script::String.new("%02x" % decimal)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment