Created
October 19, 2024 08:39
-
-
Save atomtigerzoo/9ffb703a27f3f64440478e19697e8560 to your computer and use it in GitHub Desktop.
CSS text marker effect with animation & multi-line wrapping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
mark{ | |
animation: 1.5s highlight 1.25s 1 normal forwards; | |
background-color: none; | |
background: linear-gradient(90deg, theme('colors.amber.200') 50%, theme('colors.transparent') 50%); | |
background-size: 200% 100%; | |
background-position: 100% 0; | |
} | |
@keyframes highlight{ | |
to{ | |
background-position: 0 0; | |
} | |
} | |
</style> | |
<p> | |
This is a line with <mark>some text that is highlighted</mark> and will also correctly line-break, if multi-line. | |
</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment