Jump to Content
Kimili
  • Journal
  • Portfolio
  • Projects
  • About
  • Contact

RGBa CSS Generator for Internet Explorer

04 Dec 09

If you’ve been keeping up with how recent browsers have been implementing parts of the CSS3 spec, you may already be using RGBa to define semi-transparent background colors. You’d also know that this works in recent versions of Firefox and Safari, but not in any version of Internet Explorer.

There are, however, workarounds to get semi-transparent backgrounds working in IE. One such workaround utilizes a proprietary IE filter property, DXImageTransform.Microsoft.Gradient, but using it requires you to recalculate your RGBa value into a hex code formatted as #AARRGGBB, where the AA is the alpha value in hex format. The remaining RRGGBB value is standard hex code that is familiar to anyone who writes CSS.

I recently used this workaround for a new site I’m working on, but I found the task of converting an RGBa value to a #AARRGGBB hex value to be tedious to the point of being nearly inscrutable. So I did what any lazy programmer worth his salt would do: I put together the little tool you see below to automate this conversion and give the IE-specific CSS for any RGBa definition. Try it—just enter an RGBa definition like rgba(24,104,33,0.65) below and you’ll get the version of that code which IE will understand.

And that’s all there is to it. One important thing to note: be sure to put your IE-specific code in its own stylesheet and feed it to IE using conditional comments.

I’m sure I’ll find this tool useful in the near future. I hope you do too.

Comments

Jim says:
62 days ago ∞

Only for 7 or later?
6 does not support? or “supports normal”?

James Seymour-Lock says:
7 days ago ∞

Great tool, really helps speed up the whole process! Many Thanks

Your Turn





Flickr

  • 18+91
  • Panna Cotta
  • Seen Better Days
  • Walk
  • Berth
  • Trek?
  • Vault Alarm

See more at Flickr

Recent Listening

  1. Celso Fonseca - Rive Gauche Rio
  2. Latin Playboys - Latin Playboys
  3. Orchestra Baobab - Specialist in all Styles
  4. Anoushka Shankar - Rise
  5. Miles Davis - Kind Of Blue
  6. Amadou & Mariam – Welcome To Mali
  7. Charlie Parker - Bird's Best Bop on Verve
  8. Charlie Parker - Best of The Complete Savoy & Dial Studio Recordings
  9. Björk - Homogenic

See more at Last.fm

Tweet, Tweet

Whoops, looks like something's wrong with Twitter.

©MMII—MMX Michael Bester