<h1 class="typing">You had me at 'hello'.</h1>
:root {
--background-color: #212121;
--font: sans-serif;
}
* {
margin: 0;
padding: 0;
}
body {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
background: var(--background-color);
font-family: var(--font);
}
.typing {
color: #fff;
overflow: hidden;
border-right: 0.15em solid orangered;
white-space: nowrap;
letter-spacing: 0.15em;
animation: typing 3.5s steps(30, end) infinite,
cursor-blink 0.75s step-end infinite;
}
/* The typing effect */
@keyframes typing {
from {
width: 0;
}
to {
width: 100%;
}
}
/* The typewriter cursor effect */
@keyframes cursor-blink {
from,
to {
border-color: transparent;
}
50% {
border-color: orangered;
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.