Text-overflow property

Last updated: 2026-09-13

text-overflow Text-overflow property

The text-overflow CSS property controls how text is displayed when it overflows its container. Its most common use, combined with overflow: hidden and white-space: nowrap, is to render overflowing single-line text with an ellipsis. It supports two modes: clip (truncate) and ellipsis (…), making it a standard tool for handling long text in UI design.

Category
Initial Valueclip
InheritedNo
Applies To
Animation Type
CSS VersionCSS3
StatusStandard

📝 Syntax

text-overflow: [ clip | ellipsis | <string> ]{1,2};

⚙️ Values

ValueTypeDescription
clip | ellipsisKeywordText overflow handling: clip or ellipsis

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
text-overflow v10 v12 v1 v1 v10
Supported in all major browsers
Important: text-overflow only works together with overflow: hidden (or scroll/auto) and white-space: nowrap; setting it alone has no effect.
Tip: Multi-line ellipsis requires -webkit-line-clamp together with display: -webkit-box and -webkit-box-orient: vertical, which are WebKit-specific properties.

❓ FAQ

QWhy is my text-overflow property not showing the ellipsis in CSS?
ACheck that overflow: hidden and white-space: nowrap are both set and the container has a definite width limit. Missing any of these conditions prevents the overflow ellipsis from being triggered.
QHow can I add an ellipsis to multi-line truncated text using CSS?
AStandard CSS only supports single-line ellipsis. For multiple lines, use -webkit-line-clamp to limit the line count together with display: -webkit-box and overflow: hidden; all major browsers support this today.
QHow do I write a single-line text ellipsis with the text-overflow property?
AThree properties must work together: white-space: nowrap to forbid wrapping, overflow: hidden to hide the overflow, and text-overflow: ellipsis to show the ellipsis. The container must also have a fixed or constrained width — all three conditions are required.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏