TypographyText Wrap

Text Wrap

Controls how text is wrapped within an element.

Newly available

This feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

Chrome
Edge
Firefox
Safari
ClassStyle
tw-btext-wrap: balance;
tw-ntext-wrap: nowrap;
tw-ptext-wrap: pretty;
tw-wtext-wrap: wrap;

Wrap

Initial value

The text will wrap to the next line when it reaches the end of the container.

Bleak House by Charles Dickens
London. Michaelmas term lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall. Implacable November weather. As much mud in the streets as if the waters had but newly retired from the face of the earth, and it would not be wonderful to meet a Megalosaurus, forty feet long or so, waddling like an elephantine lizard up Holborn Hill. London. Michaelmas term lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall. Implacable November weather. As much mud in the streets as if the waters had but newly retired from the face of the earth, and it would not be wonderful to meet a Megalosaurus, forty feet long or so, waddling like an elephantine lizard up Holborn Hill.
<div class="d-g g-4 max-w-64 mx-auto">
<div class="fs-xl fw-600 tc-slate tw-w">Bleak House by Charles Dickens</div>
<div class="fs-sm tc-gray-7">
London. Michaelmas term lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall...
</div>
</div>

Balance

The text will be wrapped in a way that balances the line lengths, creating a more visually appealing layout.

Bleak House by Charles Dickens
London. Michaelmas term lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall. Implacable November weather. As much mud in the streets as if the waters had but newly retired from the face of the earth, and it would not be wonderful to meet a Megalosaurus, forty feet long or so, waddling like an elephantine lizard up Holborn Hill. London. Michaelmas term lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall. Implacable November weather. As much mud in the streets as if the waters had but newly retired from the face of the earth, and it would not be wonderful to meet a Megalosaurus, forty feet long or so, waddling like an elephantine lizard up Holborn Hill.
<div class="d-g g-4 max-w-64 mx-auto">
<div class="fs-xl fw-600 tc-slate tw-b">Bleak House by Charles Dickens</div>
<div class="fs-sm tc-gray-7">
London. Michaelmas term lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall...
</div>
</div>

No Wrap

The text will not wrap to the next line, and it will overflow the container if it exceeds the width.

Bleak House by Charles Dickens
London. Michaelmas term lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall. Implacable November weather. As much mud in the streets as if the waters had but newly retired from the face of the earth, and it would not be wonderful to meet a Megalosaurus, forty feet long or so, waddling like an elephantine lizard up Holborn Hill. London. Michaelmas term lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall. Implacable November weather. As much mud in the streets as if the waters had but newly retired from the face of the earth, and it would not be wonderful to meet a Megalosaurus, forty feet long or so, waddling like an elephantine lizard up Holborn Hill.
<div class="d-g g-4 max-w-64 mx-auto">
<div class="fs-xl fw-600 tc-slate tw-nw">Bleak House by Charles Dickens</div>
<div class="fs-sm tc-gray-7">
London. Michaelmas term lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall...
</div>
</div>

Pretty

The text will be wrapped in a way that maintains a visually pleasing appearance, often used for better readability.

Bleak House by Charles Dickens
London. Michaelmas term lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall. Implacable November weather. As much mud in the streets as if the waters had but newly retired from the face of the earth, and it would not be wonderful to meet a Megalosaurus, forty feet long or so, waddling like an elephantine lizard up Holborn Hill. London. Michaelmas term lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall. Implacable November weather. As much mud in the streets as if the waters had but newly retired from the face of the earth, and it would not be wonderful to meet a Megalosaurus, forty feet long or so, waddling like an elephantine lizard up Holborn Hill.
<div class="d-g g-4 max-w-64 mx-auto">
<div class="fs-xl fw-600 tc-slate tw-p">Bleak House by Charles Dickens</div>
<div class="fs-sm tc-gray-7">
London. Michaelmas term lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall...
</div>
</div>

Using utility variants

Learn how to override existing utilities based on the user's screen size or other factors, such as hover states.

Targeting different viewports

You can combine responsive breakpoints like sm:tw-*, md:tw-*, lg:tw-*, and xxl:tw-* to allow targeting specific utilities in different viewports.

Targeting hover states

Alternatively, you can apply :hover by using h:tw-* utility to override elements and change their values when hovering over them.