text-wrap

Class Description

text-wrap

Allows text to wrap onto multiple lines.

CSS Rules

.text-wrap {
  text-wrap: wrap;
}

Usage

<element class="text-wrap" />

Responsive

Prefix .text-wrap utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:text-wrap" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="text-wrap:hover" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="text-wrap:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before text-wrap::before" />

<element class="content-after text-wrap::after" />
.text-wrap Allows text to wrap onto multiple lines.

text-nowrap

Prevents text from wrapping, forcing it onto a single line.

CSS Rules

.text-nowrap {
  text-wrap: nowrap;
}

Usage

<element class="text-nowrap" />

Responsive

Prefix .text-nowrap utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:text-nowrap" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="text-nowrap:hover" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="text-nowrap:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before text-nowrap::before" />

<element class="content-after text-nowrap::after" />
.text-nowrap Prevents text from wrapping, forcing it onto a single line.

text-balance

Sets text-wrap: balance. Evenly balances line lengths. Best for headings.

CSS Rules

.text-balance {
  text-wrap: balance;
}

Usage

<element class="text-balance" />

Responsive

Prefix .text-balance utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:text-balance" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="text-balance:hover" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="text-balance:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before text-balance::before" />

<element class="content-after text-balance::after" />
.text-balance Sets text-wrap: balance. Evenly balances line lengths. Best for headings.

text-pretty

Sets text-wrap: pretty. Avoids orphans and improves multi-line wrapping.

CSS Rules

.text-pretty {
  text-wrap: pretty;
}

Usage

<element class="text-pretty" />

Responsive

Prefix .text-pretty utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:text-pretty" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="text-pretty:hover" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="text-pretty:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before text-pretty::before" />

<element class="content-after text-pretty::after" />
.text-pretty Sets text-wrap: pretty. Avoids orphans and improves multi-line wrapping.