Skip to content

Text Wrap

Controls how text is wrapped within an element.

Utility Properties

tw-b

text-wrap: balance;

tw-n

text-wrap: nowrap;

tw-p

text-wrap: pretty;

tw-w

text-wrap: wrap;

Balance

This example sets the text wrap to balance. The text will be wrapped in a way that balances the line lengths, creating a more visually appealing layout.

Letters to Anne (Springtime'23 message)

Hi, Anne. It's finally springtime here on Earth! I can't stand windy or cold days, so I'm very excited for the spring. There are so many beautiful, colorful trees where I live.

<div class="bg-indigo-1 p-4 rad-1">
<div class="bg-white d-g g-4 max-w-80 mx-auto p-4 rad-1">
<div class="fs-xl fw-600 tc-lead tw-b">Letters to Anne (Springtime'23 message)</div>
<p class="fs-sm tc-gray-7">
Hi, Anne. It's finally springtime here on Earth! I can't stand windy or cold days, so I'm very excited for the spring. There are so many beautiful, colorful trees where I
live.
</p>
</div>
</div>

No Wrap

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

Letters to Anne (Springtime'23 message)

Hi, Anne. It's finally springtime here on Earth! I can't stand windy or cold days, so I'm very excited for the spring. There are so many beautiful, colorful trees where I live.

<div class="bg-indigo-1 p-4 rad-1">
<div class="bg-white d-g g-4 max-w-80 mx-auto p-4 rad-1">
<div class="fs-xl fw-600 tc-lead tw-nw">Letters to Anne (Springtime'23 message)</div>
<p class="fs-sm tc-gray-7">
Hi, Anne. It's finally springtime here on Earth! I can't stand windy or cold days, so I'm very excited for the spring. There are so many beautiful, colorful trees where I
live.
</p>
</div>
</div>

Pretty

This example sets the text wrap to pretty. The text will be wrapped in a way that maintains a visually pleasing appearance, often used for better readability.

Letters to Anne (Springtime'23 message)

Hi, Anne. It's finally springtime here on Earth! I can't stand windy or cold days, so I'm very excited for the spring. There are so many beautiful, colorful trees where I live.

<div class="bg-indigo-1 p-4 rad-1">
<div class="bg-white d-g g-4 max-w-80 mx-auto p-4 rad-1">
<div class="fs-xl fw-600 tc-lead tw-p">Letters to Anne (Springtime'23 message)</div>
<p class="fs-sm tc-gray-7">
Hi, Anne. It's finally springtime here on Earth! I can't stand windy or cold days, so I'm very excited for the spring. There are so many beautiful, colorful trees where I
live.
</p>
</div>
</div>

Wrap

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

Letters to Anne (Springtime'23 message)

Hi, Anne. It's finally springtime here on Earth! I can't stand windy or cold days, so I'm very excited for the spring. There are so many beautiful, colorful trees where I live.

<div class="bg-indigo-1 p-4 rad-1">
<div class="bg-white d-g g-4 max-w-80 mx-auto p-4 rad-1">
<div class="fs-xl fw-600 tc-lead tw-w">Letters to Anne (Springtime'23 message)</div>
<p class="fs-sm tc-gray-7">
Hi, Anne. It's finally springtime here on Earth! I can't stand windy or cold days, so I'm very excited for the spring. There are so many beautiful, colorful trees where I
live.
</p>
</div>
</div>

Conditional styles

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

Media modifiers

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

<div class="tw-nw md:tw-w ..."></div>
Hover modifiers

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

<div class="tw-nw h:tw-w ..."></div>