2

Possible Duplicate:
how to not apply opacity for child element?

Which is the best practice to set opacity:0.5; to the parent element like:

<div>
<span></span>

<span></span>

<span></span>
</div>

if i set opacity to the element this will set the same rule to the children elements, is there any trick to avoid the children inherition?

Community
  • 1
  • 1
itsme
  • 48,972
  • 96
  • 224
  • 345

2 Answers2

2

You can use css3 background-color:rgba(122,122,0,0.5); the last value is the opacity, and it dont force the child elements to get it.

Toping
  • 754
  • 5
  • 16
0

use rgba,

 background-color: rgba(0,0,255,0.5);
Ravindra Bagale
  • 17,226
  • 9
  • 43
  • 70