RGBA vs Opacity (w3C)

more related media: books | sites |

The Problem with Opacity and Inheritance


Example ONE below
In the past there has been a problem with opacity and inheritance. When opacity was placed on an element all of its children (content) inherited the same opacity.

The Solution


Example TWO below
Color Chart

Instead of using the hex number for color use the rgb property for color.
For example for white:
selector(
background-color: rgba(255, 255, 255,);
}

Then add the opacity (values are 0.0 - 1.0 ) to the end of the numbers in this I am using 0.5:
selector(
background-color: rgba(255, 255, 255, 0.5);

}

 

For older browsers that cannot read the rgb opacity you also need to include the color properties without the opacity.

#rgbBac{
color: #000;
background-color: rgb(255, 255, 255); /*for browser that do not read rgba*/
background-color: rgba(255, 255, 255, 0.5);
}

ONE

flowerThe problem with using opacity is inheritance.
The content of the div inherits the same opacity, as you can see by this example

 

 

div#opacity{
background-color: #fff;
color: #000;
opacity: 0.6;
}


TWO

flowerWhen you use rgba the content does not inherit the opacity.  You need to include just the background (rgb) for older browsers that  cannot read rgba


div#rgba{
color: #000;
background-color: rgb(255, 255, 255); /*for browsers that do not read rgba*/
background-color: rgba(255, 255, 255, 0.5);
}




Color Chart





share / bookmark



Send the link for this page to yourself





code

color

css

design

type

writing

images

info arch

the net

php

seo

user

usabilty


inspired


my notes


tips

Web Resources Depot Klara Schmitt
Delicious Casey Fox
A Good Usability Book: Amy Wonnell
Using PHP include(); to make header
and footer templates
Amy Wonnell
Target IE6/7: Chuck Borowicz
New window: Klara Schmitt
Target blank: Sally Hopper
Css rollover: Mary Spense
Remove link line: Patrick Cole

submit

your tips & wisdom, code
snippets, ideas, sites and
portfolios: submit

sites


Kuler Showcases designers and their specific color palette for individual projects and much much more.

Color Wheel
Distinguishes between web safe, web smart and other colors. Saves your choices.

Color Picker
Groups the colors that you select together>

Web Smart Palette
Lets you select colors using a cube and slider

books

Color

Basics Design: Color


At Amazon
Design Theory
Covers most of what you need know about color
www. color

www.color


At Amazon
Color Index One

Color Index


At Amazon
Over 1100 Color Combinations, CMYK and RGB Formulas, for Print and Web Media
Color Index Two

Color Index Two


At Amazon
Over 1500 New Color Combinations. For Print and Web Media. CMYK and RGB Formulas.
join follow up up