In this animation where I simulate the typewriter (only html/css) I would like to add 4 more variable writings but I can't because I don't understand how to work with the keyframes. I tried but he writes several words at the same time.
The second problem is that I can't exactly put "Hi, i'm a" in the center and make it move to the left when it has to write the variable word. (example: https://codepen.io/sheikh_ishaan/pen/LYEOqjd)
.box_type{
margin-left: auto;
margin-right: auto;
width: 30em;
}
h1.type {
font-size: 30px;
display:flex;
align-items: baseline;
}
.text_1 {
animation: text1;
}
.text_2 {
animation: text2;
}
.text_1, .text_2 {
overflow: hidden;
white-space: nowrap;
display: inline-block;
position: relative;
animation-duration: 20s;
animation-timing-function: steps(25, end);
animation-iteration-count: infinite;
}
.text_1::after, .text_2::after {
content: "|";
position: absolute;
right: 0;
animation: caret infinite;
animation-duration: 1s;
animation-timing-function: steps(5, end);
}
@keyframes text2 {
0%, 50%, 100% {
width: 0;
}
60%, 90% {
width: 6.50em;
}
}
@keyframes text1 {
0%, 50%, 100% {
width: 0;
}
10%, 40% {
width: 8em;
}
}
@keyframes caret {
0%, 100% {
opacity: 0;
}
50% {
opacity: 1;
}
}
<div class="box_type">
<h1 class="type">Hi, i'm a <span class="text_1"> Graphic Designer</span><span class="text_2"> Photographer</span></h1>
</div>