The Book of CSS3 - A Developer\'s Guide to the Future of Web Design (2nd edition)

(C. Jardin) #1

10


Color and opaCit y


Color in CSS2 was based around the Red,
Green, Blue (RGB) model; whether you used
hexadecimal or rgb() function values, you
had to combine those three colors to add color

to your pages. Of course, designers speak in terms


of shades and tints: When a designer says to use a


“50 percent tint” of a certain color, developers have had to use the RGB
model to match that color, which has often involved some chicanery with
a graphics package to find the exact tone needed.
The CSS Color Module (http://www.w3.org/TR/css3-color/) has a solu-
tion to that problem—and more besides. For starters, it introduces the con-
cepts of opacity through the opacity property and the Alpha color channel.
In addition, the CSS Color Module adds an entirely new color model, which
is more intuitive and easier to tweak to find the perfect tone.
The Color Module is a W3C Recommendation and is well implemented
in IE9 and above and every other major browser, so with perhaps a bit of
careful coding to provide a fallback for older versions of IE, you can begin
to use its properties and values straightaway.


PX

3024
Free download pdf