Typography

Word Break

Utilities for controlling word breaks in an element.

Quick reference

Class
Properties
break-normaloverflow-wrap: normal; word-break: normal;
break-wordsoverflow-wrap: break-word;
break-allword-break: break-all;
break-keepword-break: keep-all;

Basic usage

Normal

Use break-normal to only add line breaks at normal word break points.

Word Break - 图1

  1. <p class="break-normal ...">...</p>

Break Words

Use break-words to add line breaks mid-word if needed.

Word Break - 图2

  1. <p class="break-words ...">...</p>

Break All

Use break-all to add line breaks whenever necessary, without trying to preserve whole words.

Word Break - 图3

  1. <p class="break-all ...">...</p>

Break Keep

Use break-keep to prevent line breaks from being applied to Chinese/Japanese/Korean (CJK) text. For non-CJK text break-keep has the same behavior as break-normal.

Word Break - 图4

  1. <p class="break-keep ...">...</p>

Applying conditionally

Hover, focus, and other states

Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:break-all to only apply the break-all utility on hover.

  1. <p class="break-normal hover:break-all">
  2. <!-- ... -->
  3. </p>

For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.

Breakpoints and media queries

You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:break-all to apply the break-all utility at only medium screen sizes and above.

  1. <p class="break-normal md:break-all">
  2. <!-- ... -->
  3. </p>

To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.