CSS text-overflow Property Explained

What the CSS text-overflow property does, with an example.

Published November 5, 2026

text-overflow decides how clipped text is shown when it overflows: clip or ellipsis (…). It only works with overflow other than visible and usually white-space: nowrap.

How it works

The three-part recipe: white-space: nowrap; overflow: hidden; text-overflow: ellipsis.

For multi-line truncation use -webkit-line-clamp.

Values and effects

text-overflow: clip; → cut off
text-overflow: ellipsis; → add …

Practical examples

Single line

.name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

Two lines

.desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

In flex children

.row > .grow { min-width: 0; }

Common mistakes

  • Missing overflow: hidden so no ellipsis shows.
  • Forgetting min-width: 0 in flex items.
  • Truncating important information without a tooltip.

Key takeaways

  • text-overflow in one line: text-overflow decides how clipped text is shown when it overflows: clip or ellipsis (…).
  • Inspect it live in DevTools → Styles.
  • Test across browsers and screen sizes.

FAQ

Why no ellipsis?

The element needs a constrained width, nowrap and overflow hidden.

Is text-overflow supported in all browsers?

Yes in all modern browsers; check caniuse.com for edge cases.

More CSS articles