I'm attempting to create a fading effect on the edges of a div
by using two overlay div
s positioned absolutely on either side. My goal is to have the background of the page visible once the fade is complete, effectively masking the content of one div
with linear 'fade' gradients from the other two divs. Please refer to the diagram below for a clearer explanation...
Here are the methods I've experimented with:
- Using the
-webkit-mask
property with a linear gradient. While it works in Webkit, the result is choppy and not smooth when combined with the mask property. - Experimenting with an SVG gradient mask (like the one showcased in the Firefox / MDN demo). It works well in Firefox but not in Chrome where the quality of the gradient is lacking compared to
-webkit-mask
/linear-gradient
. - Employing a transparent GIF or PNG for masking. However, in practice, the masking color tends to show through as seen in this example on Stack Overflow.
I'm open to other suggestions or alternative layouts that could help me achieve the same visual effect. Any ideas?