CSS Background Opacity [duplicate]

Children inherit opacity. It’d be weird and inconvenient if they didn’t.

You can use a translucent PNG file for your background image, or use an RGBa (a for alpha) color for your background color.

Example, 50% faded black background:

<div style="background-color:rgba(0, 0, 0, 0.5);">
   <div>
      Text added.
   </div>
</div>

Leave a Comment