Graphics Programs Reference
In-Depth Information
Figure 7-17: Boxes with opaque and translucent RGB backgrounds.
You can also use the percentage form of RGB color values in RGBA.
.box1 { background : rgb(100%,100%,100%) ;}
.box2 { background : rgba(100%,100%,100%,0.5) ;}
h e alpha value is always represented as a number between 0 and 1 inclusive, with 0 meaning
“no opacity at all” and 1 meaning “fully opaque.” So half-opaque (and thus half-transparent)
is 0.5 . You can't put a percentage in there for historical reasons that are too messy to get into
If you supply a number outside the 0 to 1 range, it will (in the words of the specii cation) be
“clamped” to the allowed range. So if you give an alpha value of 4.2 , the browser will treat it
as if you'd written 1 . Also, it isn't clear what should happen when an alpha of 0 is used. Since
the color is fully transparent, what will happen to, say, invisible text? Can you select it? If it's
used on a link, is the link clickable? Both are interesting questions with no dei nitive answers.
So be careful.
Search WWH ::

Custom Search