text-overflow

Class Description

truncate

Truncates overflowing text with an ellipsis on a single line.

CSS Rules

.truncate {
  overflow: hidden;
  text-overflow: hidden;
  white-space: hidden;
}

Usage

<element class="truncate" />

Responsive

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

<element class="md:truncate" />

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="truncate: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="truncate: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 truncate::before" />

<element class="content-after truncate::after" />
.truncate Truncates overflowing text with an ellipsis on a single line.

text-ellipsis

Sets text-overflow: ellipsis.

CSS Rules

.text-ellipsis {
  text-overflow: ellipsis;
}

Usage

<element class="text-ellipsis" />

Responsive

Prefix .text-ellipsis 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-ellipsis" />

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-ellipsis: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-ellipsis: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-ellipsis::before" />

<element class="content-after text-ellipsis::after" />
.text-ellipsis Sets text-overflow: ellipsis.

text-clip

Clips text that overflows its container.

CSS Rules

.text-clip {
  text-overflow: clip;
}

Usage

<element class="text-clip" />

Responsive

Prefix .text-clip 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-clip" />

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-clip: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-clip: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-clip::before" />

<element class="content-after text-clip::after" />
.text-clip Clips text that overflows its container.