I am trying to create a fade effect for a paragraph from both the top and bottom. However, I am only able to achieve the fade effect from either the top or the bottom.
HTML:
<p className="bottom-overflow-fade">
{content}
</p>
CSS:
.bottom-overflow-fade {
mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
-webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
}
.top-overflow-fade {
mask-image: linear-gradient(to top, black 80%, transparent 100%);
-webkit-mask-image: linear-gradient(to top, black 80%, transparent 100%);
}
Current Result:
https://i.sstatic.net/74y6X.png
Issue:
Combining both of these classnames in the paragraph does not result in the desired fade effect. Using either one separately works perfectly for fading from either the top or bottom. Is it possible to merge both CSS properties into one to achieve a fade effect from both the top and bottom?
Note: This question is not related to any form of animation.