The question is this: you need to transfer the value in width to ch for different text blocks using css and html in order to apply the same style to text blocks of different lengths I certainly understand that these are not programming languages, but still ...
.wrapper{ display: flex; flex-wrap: wrap; width: 100%; justify-content: center; } .text { width: 5ch; overflow: hidden; background-color: red; animation: printed-text 2s steps(21); } @keyframes printed-text{ from { width: 0%; } } <div class="wrapper"> <span class="text">lorem</span> </div> <div class="wrapper"> <span class="text">loremlorem</span> </div>