I need to make line-by-line text appearance I think I have to split the text into lines and wrap each line in span.
Before:
<p>qwerty321<br>
qwerty321<br>
qwerty321<br></p>
After:
<p><span>qwerty321<br></span>
<span>qwerty321<br></span>
<span>qwerty321<br></span></p>
I think it should be like this. But I don't know how to do this. Vanilla JS
Edit: Sorry but I wrote the problem incorrectly. Look, I have some text(text in the question is just example) and I have to show it line-by-line while scrolling. That's the problem. And I don't think that I can use CSS only
`? For instance this very comment spans on multiple lines, even though there is no `
` to make a hard-break. If that's the case, have a look at https://stackoverflow.com/questions/55604798/find-rendered-line-breaks-with-javascript/55605049#55605049 from there doing the break into elements should be trivial. – Kaiido Oct 07 '21 at 03:26