Firefox shipped text-overflow: <string> in version 9 back in 2011. Chrome 157 has now implemented it, and Safari 27.3 Beta has also shipped the feature, which puts it on a path toward Baseline.

How the property behaves

The familiar value, text-overflow: ellipsis, places an ellipsis (…) at the end of the line box, replacing however many characters that glyph occupies. The default, text-overflow: clip, adds nothing at all.

<!-- Block container -->
<div>This text is overflowing its container.</div>
div {
  /* Size */
  inline-size: 170px;
  
  /* Prevent wrapping */
  white-space: nowrap;
  
  /* Hide any overflow */
  overflow-inline: hidden;
  
  /* Append string */
  text-overflow: "—";
}

Several conditions must hold before any of this is visible:

  • The text has to overflow a block container in its inline direction. In the example above, inline-size: 170px sets that limit, which becomes width when writing-mode computes to horizontal-tb.
  • white-space: nowrap is required to stop wrapping, so the text overflows once the inline space runs out. Consequently, text-overflow targets single-line text; multi-line truncation is the job of line-clamp.
  • overflow must be set to anything other than visible.

With those in place, text-overflow: "—" appends an em dash to the line box while trimming whatever characters it takes up.

Picking the string

The string's job is to make truncation unmistakable. An em dash works well because it conventionally marks interruption and abrupt cut-offs in dialogue.

A literal "…" is possible but largely duplicates ellipsis. A stronger case is […], which signals an editorial omission or design decision rather than the end of the quoted text. Avoid presentation that implies interactivity: something like [read more] looks like a makeshift button, but the text-overflow string isn't clickable, and square brackets already carry meaning. Other bracketed interpolations — [truncated], [sic], [snip], [excerpt] — extend the range of use cases.

Carets (▾) and chevrons (⌄) are themselves valid strings and hint at expandability. Again they can't be clicked to unclip the text, but the element itself can react to :hover or a similar state.

<div>Hover this container to reveal the full text.</div>
div {
  /* Size */
  inline-size: 170px;

  &:not(:hover) {
    /* Prevent wrapping */
    white-space: nowrap;

    /* Hide any overflow */
    overflow-inline: hidden;

    /* Append string */
    text-overflow: "▾";
  }
}

The property is not animatable — @starting-style doesn't change that.

The two-value form

Since overflow can be any value other than visible, a scrollable container (say overflow-inline: scroll) can take the two-value syntax and display indicators at both ends:

<!-- Block container -->
<div>Hey, scroll this container.</div>
div {
  /* Size */
  inline-size: 170px;

  /* Prevent wrapping */
  white-space: nowrap;

  /* Hide any overflow, allow scrolling */
  overflow-inline: scroll;

  /* <inline-start> <inline-end> */
  text-overflow: "///" ellipsis;
}

<inline-start> renders before the text and <inline-end> after it. In a scrolling demo, an ellipsis appears at the end when more text remains in that direction, and three forward slashes (///) appear at the start when text remains before it; when the content overflows in both directions, both indicators show simultaneously. Only Firefox has implemented this two-value syntax.

When content is being scrolled, or when a focused element has editable content, user agents fall back to text-overflow: clip so the full text stays visible during interaction. This behavior can differ across browsers.

Logical values and what's coming

The single-value syntax respects direction, so it is logical as well as custom. Beyond that, text-overflow: fade() and fade are in progress: fade(1em) starts fading the line 1em from the end of the line box, fade(10%) starts at 10% from the end, and either way the content is fully transparent by the end. Plain fade leaves the value to the user agent.

line-clamp works much like text-overflow but for multi-line text, with two limits: it can only truncate the last line, not the first, and it looks unlikely to support fade() or fade. Once browsers cover all of these features, the two properties together should prove considerably more useful than either did alone.