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

Sometimes, we want to give text or an image a transparent background using CSS

We’ll look at how to give text or an image a transparent background using CSS, in this article.

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

We set the background-color property, To give text or an image a transparent background using CSS .

For instance, we can write

<p style="background-color: rgba(255, 0, 0, 0.5)">
  <span>Hello, World!</span>
</p>

to set the background-color to a rgba value.

And the last value is the opacity.

Conclusion

Then we set the background-color property, to give text or an image a transparent background using CSS.

Leave a Reply