Typewriter Animation
Adds a typewriter animation + blinking cursor
- blinking
- typewriter
Code
.typewriter{
display: flex;
justify-content: center;
}
.typewriter p {
overflow: hidden;
font-size: 1.5rem;
font-family: monospace;
border-right: 1px solid;
margin-inline: auto;
white-space: nowrap;
/* The cursor will inherit the text's color by default */
/* border-color: red */
/* Steps: number of chars (better to set directly in js)*/
animation: typing 3s steps(21) forwards,
blink 1s step-end infinite;
}
@keyframes typing{
from{
width: 0%
}
to{
width: 100%
}
}
@keyframes blink{
50%{
border-color: transparent;
}
}