I have added a typewriter effect on some text on a webpage, however that section is in middle of the page. And the animation starts as soon as someone visits the page so the user is not able to see that animation. I have used only CSS for that animation and used Bootstrap for the webpage. I am not that familiar with JavaScript and was facing problem implementing solutions provided on the internet. I would really appreciate if you look into it and help me out.
CSS
<style>.pcb-text {
display: flex;
justify-content: center;
align-items: center;
}
@media only screen and (max-width: 600px) {
.pcb-text p {
font-size: 20px;
animation: typing 3s steps(56), blink-caret 0.85s step-end infinite;
overflow: hidden;
/* Ensures the content is not revealed until the animation */
white-space: nowrap;
/* Keeps the content on a single line */
margin: 0 auto;
/* Gives that scrolling effect as the typing happens */
border-right: .12em solid orange;
/* The typewriter cursor */
/*width: 28ch; !*To stop cursor from going further right than necessary *!*/
}
}
@media only screen and (min-width: 601px) {
.pcb-text p {
font-size: 60px;
animation: typing 3s steps(56), blink-caret 0.85s step-end infinite;
overflow: hidden;
/* Ensures the content is not revealed until the animation */
white-space: nowrap;
/* Keeps the content on a single line */
margin: 0 auto;
/* Gives that scrolling effect as the typing happens */
border-right: .12em solid orange;
/* The typewriter cursor */
/*width: 28ch; !*To stop cursor from going further right than necessary *!*/
}
}
@keyframes typing {
from {
width: 0;
}
to {
width: 100%;
}
}
/* The typewriter cursor effect */
@keyframes blink-caret {
from,
to {
border-color: transparent
}
50% {
border-color: orange;
}
}
</style>
<div class="pcb-text">
<div class="text-center">
<p>Physics, Chemistry, Biology.</p>
</div>
</div>