Forked from philippbosch/cross-browser-rgba-mixin.scss
Created
January 1, 2012 06:58
-
-
Save scottdavis/1546562 to your computer and use it in GitHub Desktop.
image-less RGBA backgrounds for real browsers and Internet Explorer
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
@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; | |
} |
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
module Sass::Script::Functions | |
module SassHex | |
def hex(decimal) | |
Sass::Script::String.new("%02x" % decimal) | |
end | |
end | |
include SassHex | |
end | |
# All you should have todo is require the sass-hex.rb file | |
# I use this trick a lot in compass when extending sass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment