When you use the CSS opacity property for an element, all its children inherit from it, and you won't change anything to change it ...
... except that you can use transparent png background image or use rgba() or hsla() color values.
So the transparent black rgba will be background: rgba(0, 0, 0, .5); and hsla background-color: hsla(0, 0%, 0%, .5);
These properties are not inherited and therefore do not affect children, whatever they are :)
Here you can see three different CSS rules (not transparent png). Please note that the children of the last two are not affected :)
http://jsfiddle.net/SJK2H/
source share