I am looking to create an effect like this, but my website has a dynamic background-color
. Note that this example uses a white overlay, which does not work with different backgrounds.
p {
width: 300px;
overflow: hidden;
height: 50px;
line-height: 50px;
position: relative;
}
p:after {
content: "";
width: 100px;
height: 50px;
position: absolute;
top: 0;
right: 0;
background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,1));
}
What I was hoping to do was to set up a CSS opacity gradient. This sort of works, but the code is too messy. Looking at this second example, I could implement it in jQuery, but is there any way to do this entirely in CSS?
See Question&Answers more detail:os