+ 9
What is the color code for transparent "color" or How can a give an elemment a transparent color?
5 Réponses
+ 7
There are many way of understanding "transparent" color...
Beside html named color, you could use the keyword "transparent" to define a css property requiring a color to not have opaque color at all.
rgba() and hsla() have a fourth parameter (in 0;1 range) to define an alpha channel of the color.
Even hexadecimal could have a fourth alpha parameter by defining a 32bit color instead of common 24bit color, but I believe that's less widely supported.
Finally, you could use the 'opacity' css property (in 0;1 range) to define a degree of transparency to an element (and make it more or less translucide, from 0 transparent to 1 opaque), as well as use the 'visibility' css property wich set under the hood the 'opacity' property to 0 (for 'hidden' value) or 1 (for 'visible' value)...
+ 3
For defining a transparent color, use rgba() format:
color: rgba(x, y, z, 0);
where x, y and z are arbitrary values.
The last argument 0 defines the opacity i.e., zero!
+ 1
#element-css {
color: #FFFFFF;
opacity: 0.5;
}
In this example, "opacity: 0.5;" defines an element transparency of 50% to the html object with the "element-css" id attribute.
+ 1
{
Color: rgba(0,0,0,0.5), rgba(0,0,0,0.5), dark-green;
}
+ 1
You can decrease or increase the last 0. Number to the amount it looks ok for you and you can change the dark-green to any color you want obviously