Skip to content

Word Break

Word break utilities set word-break. They are the last line of defence against a long URL or an unbroken identifier pushing a layout wider than its container.

Class word-break
word-break-normal normal
word-break-break-all break-all
word-break-keep-all keep-all
word-break-break-word break-word
<p class="word-break-break-all">https://example.com/a/very/long/path/that/does/not/fit</p>
<p class="word-break-normal word-break-md-break-word">Wraps only when narrow</p>

Responsive: word-break-sm-break-all … word-break-2xl-keep-all.

These classes are in the separate responsive module: import nightcss/utilities/responsive after the base bundle, or use nightcss/full.

  • break-all can break a word at any character. Use it for code, hashes, and URLs, not for prose.
  • break-word only breaks a word when it would otherwise overflow; it is the gentler option for user-generated text.
  • keep-all prevents breaks between CJK characters. It is not a general “do not wrap” switch; use White Space for that.
  • For a single line with an ellipsis, use Truncation.