CSS & layout

Chrome 157 joins Firefox on custom text-overflow strings, with Safari in beta

Chrome 157 joins Firefox on custom text-overflow strings, with Safari in beta

This one has been sitting in Firefox for fifteen years. Firefox shipped text-overflow: <string> in Firefox 9, back in 2011. Daniel Schwarz reports on CSS-Tricks that Chrome 157 has now implemented it and Safari 27.3 Beta has shipped it as well, so he expects it to reach Baseline soon. Note the word "expects". Baseline isn't declared yet, and the Safari support is still in a beta.

What it does is small and very welcome. Truncated single-line text used to end in one of two ways, ellipsis or clip. Now the value can be any string you put in quotes.

What changed

The single-value syntax takes a string in place of a keyword. Here's the example from the article, which cuts the line off with an em dash:

div {
  inline-size: 170px;
  white-space: nowrap;
  overflow-inline: hidden;
  text-overflow: "—";
}

Schwarz points to the editorial reasons you'd want something other than an ellipsis. An em dash reads as interrupted dialogue, and he lists [truncated], [sic], [snip] and [excerpt] as other common bracketed markers.

The one I'd reach for first is the empty string. text-overflow: "" truncates the overflowing characters without adding anything in their place. That sounds like clip, but the article draws the line clearly: the default text-overflow: clip can leave fractional characters hanging at the edge, while the empty string removes the overflowing characters outright. If you've ever shipped a label that ends in half a letter, this is your fix.

The rules haven't moved

A string doesn't loosen any of the old requirements. Per the source, the text still has to:

  • overflow in the inline direction
  • sit under white-space: nowrap, so it stays on one line
  • have overflow set to anything other than visible

So if your custom marker isn't showing up, check those three before you blame the browser. And for text that wraps across several lines, this isn't the tool. That job belongs to line-clamp, which Schwarz calls essentially the same thing for multi-line text, with one difference: it can only truncate the last line.

The single-value syntax also respects direction, so it behaves logically in right-to-left text without extra work.

Rough edges

Two limits from the article worth knowing before you design around this. The string isn't clickable, so you can't turn your marker into a "read more" link. And truncation isn't animatable.

You can still get a reveal-on-hover effect by moving the truncation rules behind :not(:hover), as the article shows:

div {
  &:not(:hover) {
    white-space: nowrap;
    overflow-inline: hidden;
    text-overflow: "▾";
  }
}

Hover the container and the full text comes back. Keep in mind this only helps pointer users. Someone on a touchscreen or a keyboard won't trigger :hover, so the full text needs another route to them.

Where support stands

Here's the state of things according to the source:

  • Single-value syntax: Firefox since version 9 (2011), Chrome 157, Safari 27.3 Beta.
  • Two-value syntax: Firefox only.

The two-value form puts a string at each end of a scrollable container, inline-start first and inline-end second:

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

With only one engine behind it, I'd treat that one as a progressive enhancement and nothing more.

What I'm watching next

Two things. First, whether Safari's support makes it out of beta, since that is the step Schwarz is counting on for Baseline. Second, fade(). The article describes it as a future value where text-overflow: fade(1em) would start fading the line 1em from the end of the line box and fade(10%) would start 10% from the end, fully transparent by the edge either way. Nothing in the source says any browser ships it yet, so for now it's a sketch. A good one, though.

Source: CSS-Tricks (css-tricks.com)

Related
Browser releases

Safari Technology Preview 246 widens color, images and attr()

WebKit has shipped Safari Technology Preview 246 with a batch of CSS additions — light-dark() taking image values, image(<color>), alpha(), color-mix() with more than two colors, attr() on pseudo-elements, and preview support for font-variant-emoji and word-break: auto-phrase.

June 23, 2026
CSS & layout

Spatial CSS preview puts 3D models on transform and anchor positioning

Safari on visionOS 27.3 ships a flag-gated preview of the proposed spatial CSS API, which collects <model> elements in a shared portal and arranges them with transform, position-anchor and a new @environment-map at-rule.

November 20, 2026
CSS & layout

tidy-typography.css is a reset that only touches the text

On CSS-Tricks, Stu Robson builds tidy-typography.css, a typography-only default stylesheet that combines container query units, text-box trimming, text-wrap, tuned hyphenation and OpenType controls. He notes that some of the features are experimental and that browser support is uneven.

November 7, 2026