• support@answerspoint.com

How to give text or an image a transparent background using CSS?

381

Is it possible, using CSS only, to make the background of an element semi-transparent but have the content (text & images) of the element opaque?

I'd like to accomplish this without having the text and the background as two separate elements.

When trying:

 

<p style="position:absolute;background-color:green;filter:alpha(opacity=60);opacity:.6;">
  <span style="color:white;filter:alpha(opacity=100);opacity:1;">Hello world</span>
</p>

it looks like child elements are subjected to the opacity of their parents, so opacity:1 is relative to the opacity:.6 of the parent.

  • CSS

  • asked 3 years ago
  • B Butts

0Answer


Your Answer

    Facebook Share