Languages
[Edit]
EN

CSS - set element transparent background

3 points
Created by:
Aleena
694

In this article, we would like to show you how to set an element transparent background using CSS.

Quick solution:

or:

Note: alternative solution will set whole element opacity to 50%, while the first one will set only the background opacity.

 

Practical example

Edit

In this example, we create a transparent div element using RGBA color schema. Alpha channel is set as the fourth parameter to 0.5 which means our element will be 50% transparent.

Note: the alpha parameter (fourth parameter in RGBA) is a floating-point number between 0-1, where 0 means fully transparent and 1 not transparent color.

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join