CSS text-overflow: <string> value
- Category
- CSS
- Type
- New or changed feature
- Status
- Proposed (Chrome Proposed)
- Intent stage
- None
WPT details: `text-overflow-string-*` files in https://wpt.fyi/results/css?label=master&label=experimental&aligned&q=text-overflow-string Note that there is tentatives for "[css-text-3] Discarding Line Breaks Adjacent to Ambiguous Characters". https://github.com/w3c/csswg-drafts/issues/5017
Summary
Adds a <string> value to the text-overflow property. This allows web authors to specify a custom string (e.g., "(more)") to indicate that text has been clipped. This provides more design flexibility and can be used to create more user-friendly and context-aware overflow indicators.
Motivation
Chromium's text-overflow implementation only supports the clip and ellipsis keywords, so authors who want a different truncation indicator must truncate the text themselves in JavaScript or overlay a positioned pseudo-element on the end of the line. Supporting the specified <string> value lets the browser truncate the text and render the author's chosen indicator together.
Standards & signals
- Specification: https://drafts.csswg.org/css-overflow-4/#text-overflow
- Firefox: Shipped/Shipping — Some of the new WPTs are broken because of two cases. - Clipping the rendering of the ellipsis itself if there is insufficient space for the ellipsis. https://www.w3.org/TR/css-overflow-4/#ellipsing-details - Suppressing line breaks as Ruby. https://github.com/w3c/csswg-drafts/issues/12557
- Safari: Shipped/Shipping — The PR has been merged but it's not released yet.
- Web developers: No signals
- Tracking bug: https://issues.chromium.org/issues/41492459
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=text-overflow-string
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+CSS%20text-overflow%3A%20%3Cstring%3E%20value
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=CSS%20text-overflow%3A%20%3Cstring%3E%20value
- Baseline status: https://webstatus.dev/?q=CSS%20text-overflow%3A%20%3Cstring%3E%20value
Explainers: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/text-overflow#string