Pekka 웃 Pekka 웃 - 6 months ago 42
CSS Question

Hex colors: Numeric representation for "transparent"?

I am building a web CMS in which the user can choose colours for certain site elements.
I would like to convert all colour values to hex to avoid any further formatting hassle ("rgb(x,y,z)" or named colours). I have found a good JS library for that.

The only thing that I can't get into hex is "transparent". I need this when explicitly declaring an element as transparent, which in my experience can be different from not defining any value at all.

Does anybody know whether this can be turned into some numeric form? Will I have to set up all processing instances to accept hex values or "transparent"? I can't think of any other way.

Seb Seb

Transparency is a property outside the color itself, also known as alpha component. You can't code it as RGB.

If you want a transparent background, you can do this:

background: transparent;

Additionally, I don't know if it might be helpful or not but, you could set the opacity property:

  opacity: 0.5;
  filter: alpha(opacity=50);

You need both in order to get it working in IE and all other decent browsers.