What is the color code for transparent "color" or How can a give an elemment a transparent color? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

What is the color code for transparent "color" or How can a give an elemment a transparent color?

19th Mar 2018, 4:24 PM
Paty Gz
Paty Gz - avatar
5 Answers
+ 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)...
20th Mar 2018, 2:24 AM
visph
visph - avatar
+ 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!
19th Mar 2018, 5:09 PM
777
777 - avatar
+ 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.
20th Mar 2018, 7:03 PM
HoracioOn
HoracioOn - avatar
+ 1
{ Color: rgba(0,0,0,0.5), rgba(0,0,0,0.5), dark-green; }
4th Apr 2018, 8:39 PM
Abdullah Yaser Abdo Ali
Abdullah Yaser Abdo Ali - avatar
+ 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
4th Apr 2018, 8:41 PM
Abdullah Yaser Abdo Ali
Abdullah Yaser Abdo Ali - avatar