I'd like a divs opacity to decrease in direction left, top, right or down just like a linear-gradient
does it in the background-image
, but just for the whole appearance (not just the background). Is there any way of doing it?
I've tried doing it with this code:
html
<body>
<div id="outer">
<div id="content">
<!-- content -->
</div>
<div id="inner">
</div>
</div>
</body>
css
#outer {
height: 500px;
width: 500px;
padding-left:20px;
}
#inner {
position: absolute;
height: 500px;
width: 500px;
background-image: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1));
z-index: 999;
}
#content {
position: absolute;
height: 500px;
width: 500px;
}
As expected it worked really well with colors, but now I'd like to insert an image as background of the body and obviously it won't work like this, how would any of you do this?
Edit:
Some of you marked it as a duplicate of css gradient opacity slide image left to right color white but It's not the same;
I'm not talking about making the background-image
get a linear-gradient over it, I'm talking about making a part of the whole div disappear like a gradient.