Mrs. Yanti’s narrow card on the notice board: set overflow-wrap, word-break, hyphens and lang, then every line the browser made is measured and each break is…
"Why does this URL stretch my card?" is an everyday layout bug. The three properties look alike but differ subtly: one cuts a word only when it must, one cuts anywhere, one adds hyphens when the language is known. Seeing the break points makes the choice obvious.
Text only breaks at break points; break-word adds one only when cornered
hyphens: auto is set but no hyphen ever shows up It needs a known language through the lang attribute (on the element or inherited from <html lang="id">) and that language’s dictionary in the browser. Without both, nothing happens.word-break: break-all makes Latin text look chopped break-all cuts between every letter, words that fit included. For Latin text use overflow-wrap: break-word (or anywhere in flex/grid).overflow-wrap, word-break). Cutting one line = white-space: nowrap; overflow: hidden; text-overflow: ellipsis, and there overflow-wrap does nothing.overflow-wrap: break-word The URL now breaks at a line end (orange tick = mid-word), the overflow becomes 0px, and every other word stays whole.word-break: break-all Red ticks appear: words that would fit get cut in the middle. Fine for CJK text, bad for Latin text.hyphens: auto, then change lang With lang="" nothing is hyphenated; with a language your browser has a dictionary for, hyphens show up.container: flex: compare break-word and anywhere With break-word the card still breaks (see the min-content tape). With anywhere, min-content shrinks and the URL fits.