Oct 2011 04

Say you want to set the background color of something to black. In CSS, you might write something like:

background-color: #000000;

But, what if you wanted the color to be less dark while showing whatever is underneath it like what you’d get by specifying 50% opacity in Photoshop. To do that, do the following:

background-color: rgba(0, 0, 0, 0.5);

The first 3 parameters are the red, green and blue values and the fourth is the alpha transparency from 0 to 1.

Share

Leave a Comment