Created
March 29, 2012 06:44
-
-
Save jensgro/2234245 to your computer and use it in GitHub Desktop.
rgba() for all browsers
This file contains hidden or 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
/* all modern browsers, including IE9 */ | |
.box { | |
background-color: rgba(0,0,0,0.5); | |
} | |
/* for oldIE ( ≤ IE 8 ) - should be in a special CSS-file */ | |
.box { | |
filter:progid:DXImageTransform.Microsoft.gradient(startColorStr=#7f000000,endColorStr=#7f000000); | |
/* if you want to, add this especially for IE8 */ | |
-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr=#7f000000,endColorStr=#7f000000)"; | |
/* sometimes you must trigger hasLayout for the color to be seen */ | |
zoom: 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Conversion of alpha to hex is easy with this tool: http://beijingyoung.com/articles/rgba-argb-converter/
It provides example-code, too.