CSS is powerful, you can do a lot of things without JS, also it's important because it controls all design-related aspects of your website. Typography, colors, page layouts, and any other visual aspects of your website are all controlled by mighty CSS.
I rely on CSS, which means I use Javascript as little as possible. Today I will show you the typing effect without any JavaScript!
Let's jump to the code!
<div class="container">
<div class="type">
This is one cool effect
</div>
</div>
And a little bit of CSS
.container {
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.type {
width: 35%;
animation: typing 2s steps(22), blink .5s step-end infinite alternate;
white-space: nowrap;
overflow: hidden;
border-right: 3px solid;
font-family: monospace;
font-size: 2em;
}
@keyframes typing {
from {
width: 0
}
}
@keyframes blink {
50% {
border-color: transparent
}
}
This is our result:
Thank you all!