Skip to content

Instantly share code, notes, and snippets.

@jensgro
Created March 29, 2012 06:44
Show Gist options
  • Save jensgro/2234245 to your computer and use it in GitHub Desktop.
Save jensgro/2234245 to your computer and use it in GitHub Desktop.
rgba() for all browsers
/* 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;
}
@jensgro
Copy link
Author

jensgro commented Aug 30, 2013

Conversion of alpha to hex is easy with this tool: http://beijingyoung.com/articles/rgba-argb-converter/
It provides example-code, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment