[thelist] background color opacity but solid color text?

misterhaan misterhaan at track7.org
Fri Nov 28 13:03:39 CST 2008

Tris wrote:
> how can I produce a 50% opacicty background color of black..
> but still have pure white text on top..
> it keeps making the text as opac as the background..?
> i've got two divs..
> one for the backgroud and an imbedded div for the text... :-(
i was looking at this recently as well -- the short answer is it doesn't 
work that way.  the opacity applies to the entire element and its 
children, not just the background (wouldn't background-opacity be handy 
though?)  i even tried setting opacity on child elements to 200% (since 
200% of 50% gets you back to 100%...right?) but that doesn't work since 
opacity >100% doesn't actually mean anything.

so your options are to take your text div outside of the background div 
and position it on top of the background div (so the opacity only 
applies to the background div), or as someone else suggested but the 
opacity in a png image that you use as the background and don't use the 
css property.

More information about the thelist mailing list