- 1

How to fade the background image??

14th Jun 2017, 6:26 AM
Ridhima Singla
6 Answers
+ 16
background-image: url(my_image.png); background-color: rgba(255,255,255,0.6); background-blend-mode: lighten;
14th Jun 2017, 7:21 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 14
(Opacity would fade the content too!...)
14th Jun 2017, 6:51 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 6
use opacity.
14th Jun 2017, 6:43 AM
Ranjan Bagri
Ranjan Bagri - avatar
+ 4
The 'problem' of the 'opacity' css property is that it will be applied not only to the background, but all the content of the element targeted, what's not commonly expected... To work around, we need to use 'position' possibility, to handle in once container at least two layers objects (one background and another one foreground), to be able to set opacity on the background layer without affecting the foreground one. Obviously, you can animate the 'opacity' property, with '@keyframes' and/or 'transition' css functionnalities: https://code.sololearn.com/WlkjRum5ePcG/#css
14th Jun 2017, 10:16 AM
visph
visph - avatar
+ 2
do you know what "a" stands for hsla or rgba? Just go and check out css lessons
14th Jun 2017, 7:05 AM
Petros Papageorgiou
Petros Papageorgiou - avatar
+ 2
exactly this dear @ValentinHacker
14th Jun 2017, 9:29 AM
Petros Papageorgiou
Petros Papageorgiou - avatar