Created
January 31, 2022 17:57
-
-
Save pagelab/151683772125c374296aec6df18682af to your computer and use it in GitHub Desktop.
Typewriter effect (CSS only)
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
.writer { | |
font-family: Courier, monospace; | |
display: inline-block; | |
} | |
.writer-text { | |
display: inline-block; | |
overflow: hidden; | |
letter-spacing: 2px; | |
animation: typing 5s steps(30, end), blink .75s step-end infinite; | |
white-space: nowrap; | |
font-size: 30px; | |
font-weight: 700; | |
border-right: 4px solid orange; | |
box-sizing: border-box; | |
} | |
@keyframes typing { | |
from { | |
width: 0% | |
} | |
to { | |
width: 100% | |
} | |
} | |
@keyframes blink { | |
from, to { | |
border-color: transparent | |
} | |
50% { | |
border-color: orange; | |
} | |
} | |
</style> | |
<body> | |
<div class="writer"> | |
<div class="writer-text">Twinkle, twinkle, little star.</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source: https://devdojo.com/yokwejuste/the-ultimate-solution-to-typewriter-animation