I've created an HTML file and implemented a typewriter-like animation using typed.js.
Here's the code snippet:
var typed = new Typed('#typed', {
stringsElement: '#typed-strings',
smartBackspace:true,
typeSpeed:100,
backSpeed:80,
startDelay:20,
backDelay:20,
loop:true,
showCursor: true,
cursorChar: '|',
autoInsertCss: true
});
.center {
position: relative ;
top: 50%;
left: 50%;
font-family: Arial, Helvetica, sans-serif;
font-size: 48px;
}
.typed-cursor {
display: inline;
font-size: 48px;
opacity: 1;
animation: blink .7s infinite;
}
@keyframes blink {
0% {
opacity: 1;
}
50% {
opacity: 0;
}
100% {
opacity: 1;
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/typed.js/2.0.6/typed.js"></script>
<div id="typed-strings">
<p>Myself Big Bounty</p>
<p>I'm a coder</p>
<p>I'm ML enthusiast</p>
</div>
<span id="typed" class="center"></span>
Why is the cursor moving away from the text? How can I align the cursor properly with the text?