css: RGB colors and RGBA colors
Posted by admin at 5:11AM Mar 04, 2010 tutorials|
1 comments
In CSS you don't just have to use hex colors (i.e. #333333) but you can also use RGB colors (i.e. 255, 255, 255) and RGBA colors (i.e. 255, 255, 255, .9).
RGB stands for Red Green Blue and RGBA stands for Red Green Blue Alpha (basically, opacity, the maximum value of 1.0, or 100%). The maximum value for each color is 255 and the minimum is 0.
RGB and RGBA can replace hex colors in any part of the style sheet.
Example:
In the example above I just chose random values for RGBA but it will work to output a translucent color.
RGB stands for Red Green Blue and RGBA stands for Red Green Blue Alpha (basically, opacity, the maximum value of 1.0, or 100%). The maximum value for each color is 255 and the minimum is 0.
RGB and RGBA can replace hex colors in any part of the style sheet.
Example:
background: rgba(255, 78, 40, .89) url('backgroundimage.jpg') fixed no-repeat;In the example above I just chose random values for RGBA but it will work to output a translucent color.
