CSS/Properties/color/RGBA

From W3C Wiki
< CSS‎ | Properties‎ | color
Revision as of 21:52, 21 July 2011 by Plehegar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

RGBA(Red-Green-Blue-Alpha)

The RGB color model is extended in this specification to include “alpha” to allow specification of the opacity of a color.

The format of the RGBA Value

  • rgba(R,G,B,A) -integer-
    The format of an RGBA value in the functional notation is ‘rgba(’ followed by a comma-separated list of three numerical values (three integer values), followed by an <alphavalue>, followed by ‘)’.


  • rgba(R,G,B,A) -percentage-
    The format of an RGBA value in the functional notation is ‘rgba(’ followed by a comma-separated list of three numerical values (three percentage values), followed by an <alphavalue>, followed by ‘)’.


Example

Alphahsla(H,S,L,A)Color 
0.0rgba(255, 0, 0, 0.0) fully transparent
0.2rgba(255, 0, 0, 0.2)  
0.4rgba(255, 0, 0, 0.4)  
0.6rgba(255, 0, 0, 0.6)  
0.8rgba(255, 0, 0, 0.8)  
1.0rgba(255, 0, 0, 1.0) fully opaque


Point, Note

  • If RGBA values are not supported by a user agent, they should be treated like unrecognized values per the CSS forward compatibility parsing rules ([CSS21], Chapter 4). RGBA values must not be treated as simply an RGB value with the opacity ignored.


CSS Reference

CSS Color defines the RGBA color values in 4.2.2. RGBA color values.