word-break: break-all sometimes fail on really long text (~10000 characters), why and how to fix it?
I simple have a span element, with random letters (a~z) on it, around 100000, no spaces. I used word-break: break-all, and it worked as intended, the text would not overflow.
But...
There are random points in the doc where some letters do overflow outside. On this amount of text, it usually happens 3 or 4 times in the whole doc on random points. The screenshot shows that all text is perfectly aligned (cause it is a monospaced font) except on these random areas where a couple slip outside...
Is that just the browser failing on the huge amount of characters? Or something else? If so, is it fixable?
7 Replies
trying to replicate it, but doesnt happen to me.
can you replicate it in a codepen?
https://codepen.io/MarkBoots/pen/LYqpeja
o wait, it did
yea, must be some hick up from the browser
I just went up to 100_000 words and no issues. The only inconsistency is when I comment out monospace font
lots of calc and painting. could be a capacity thing
1mill also nothing, but withou specifying max-width or margin its hard to tell because the text overflows a bit under the scrollbar. But there's no horizontal scroll either, so...
Still, I'm curious what's the use case for this please! 😄
yea, like to know it too
if it is just random, just hide the overflow i guess