I saw this sweet highlighting trick and you won't believe what happened next...
This is an implementation of a nice animated highlighting effect as it can be seen on the project bloks website . Only difference is that it's done here with all fancy css-variables and using mix-blend-mode to even make it work with different background-colors.
It uses 100% organic Javascript (pure ES6, no library-sugar) that makes it easy to integrate into almost every regular website (sorry react-users, but you can just as easily use the css and let react do the rest...)
A note on Browser-support: CSS-Variables are a thing now, and it's just awesome!! (well at least for Firefox, Chrome and Safari, Edge will probably follow soon. Do we still talk about IE these days?). The same goes for ES6-support (unless your browser is Safari), which is why I didn't enable babel for the JS-Code (again, if your browser is Safari, you might want to do this now to see the effect).
And what if CSS-Variables are not supported? Good question. For these cases there exists a post-css plugin that seems to do a decent job of at least creating a good static fallback (in this case the scroll-effect doesn't work, or the JS would need to generate the whole grandient-definition instead of just updating a variable and where's the fun in that, right?).
Whoa. Look how awesome this is!!
Although it is to say, that it only works across multiple lines with inline elements which is why the headline above needs to contain a <span class="highlight"> . Oh and heres some blind-text that is just there because I can't be bothered to fix the last remaining edge-cases:
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.