How can i control the opacity of a picture or background color of a container or a button or a form in CSS? Which property should use?
Asked
Active
Viewed 49 times
-5
-
1Using the `background-color: rgba(0,0,0,.5)` will apply opacity on the parent element and the child elements will not be affected. Or just `opacity: .5` – Morpheus Jun 06 '17 at 12:14
-
Just use [Google](https://www.w3schools.com/cssref/css3_pr_opacity.asp) ! – Dwhitz Jun 06 '17 at 12:16
-
2Possible duplicate of [How do I give text or an image a transparent background using CSS?](https://stackoverflow.com/questions/806000/how-do-i-give-text-or-an-image-a-transparent-background-using-css) – Remolten Jun 06 '17 at 16:06
1 Answers
1
You can use the RGBA system. The A stands for Alpha which mean the opacity of the color. So let's say you want to have a transparency of 50% you have to use this code:
background-color: rgba(0,0,0,0.5);

Spitzbueb
- 5,233
- 1
- 20
- 38