CSS text-wrap Property
Description
The text-wrap property controls whether and how inline text content is allowed to break and continue onto subsequent lines within its containing box. At a conceptual level it determines whether long sequences of characters (words, URLs, or other continuous runs) may wrap to the next line or must remain unbroken, and it therefore directly affects line breaking opportunities, container height, and horizontal overflow. When used carefully, it is one of the primary tools for managing how textual content adapts to narrow viewports, responsive columns, and tight UI regions.
Because line breaking is the result of multiple interacting rules, text-wrap is most useful when considered alongside related layout properties. For example, it complements white-space, which governs whether normal whitespace can create wrap opportunities at all and whether sequences of spaces are collapsed; it works together with overflow-wrap (formerly word-wrap) that provides additional opportunities to break long words to avoid overflow; and it interacts with word-break, which can change line-break behavior for certain languages and scripts. Automatic hyphenation provided by hyphens can further refine where a wrapped word is split, improving visual flow and readability.
In practical layout work, text-wrap helps prevent unwanted horizontal scroll and clipped text in cards, buttons, table cells, and navigation items by allowing content to reflow instead of forcing the box to grow. Conversely, when you need tightly controlled single-line elements (such as badges or tagged labels) you may intentionally disable wrapping and combine that with truncation techniques; in fluid layouts, enabling controlled wrapping can reduce the need for JavaScript resizing hacks. Because wrapping affects line count, it also influences vertical rhythm and the calculation of heights in flex and grid items — enabling wrap can change alignment and spacing unexpectedly, so always verify behavior across breakpoints.
From a readability and internationalization perspective, wrapping behavior should respect language and typographic conventions: different scripts and punctuation habits produce different desirable break points, and allowing intelligent breaks (often via the other properties above) improves comprehension. Also consider the visual balance of lines — too-aggressive wrapping can create rivers or ragged edges that hurt legibility, while too-lenient settings can force awkward overflows. In short, use text-wrap as part of a small set of complementary properties to produce robust, readable, and responsive text layouts.
Definition
- Initial value
- wrap
- Applies to
- text and block containers
- Inherited
- yes
- Computed value
- as specified
- Animatable
- yes
- JavaScript syntax
- object.style.textWrap
Syntax
text-wrap: wrap | nowrap | balance | pretty | stable
Values
- wrapText wraps at normal break points (e.g., spaces) to stay within the container.
- nowrapext does not wrap - long lines overflow the container instead of breaking.
- balance Text wraps so that line lengths are evenly balanced, improving legibility for short blocks like headings. Browsers currently limit this to a small number of lines for performance.
- pretty Similar to wrap but uses a slower algorithm to optimize typographic quality, reducing orphans and improving overall text flow.
- stableBehaves like wrap, but when editing content (e.g., in a contenteditable element), earlier lines stay stable instead of reflowing as text changes.
Example
Browser Support
The following information will show you the current browser support for the CSS text-wrap property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
