Here’s my CSS that highlights :target
pseudo-elements with a green background, then fades out the background over four seconds:
@keyframes highlight {
0% {
background: green
}
100% {
background: none;
}
}
:target {animation: highlight 4s;}
Can this be simplified, by using transition
?
2
Answers
One hacky idea that crossed my mind (I will probably find a better one later)
You could try to make the target element become transparent by using
opacity:0
or change the element’s background color with opacitybackground-color:rgba(0,128,0,0)