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
  • 47,321
  • 93
  • 214
  • 341

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
  • 758
  • 5
  • 16
0

use rgba,

 background-color: rgba(0,0,255,0.5);
Ravindra Bagale
  • 16,715
  • 9
  • 41
  • 70