CSS Text Overflow Ellipsis: What It Changes and When to Use It
How CSS text-overflow: ellipsis works, what it does and does not change in your text, and how it affects copying, search and accessibility.
The CSS text-overflow property, set to ellipsis, is one of the most common ways to shorten text on a web page. When a line of text is too long for its box, the browser cuts it off and draws an ellipsis (…) at the edge. The text itself stays the same. This review explains what the property does, what it takes to make it work, and when you need a different approach so that meaning and usability are not lost.
Is CSS text ellipsis suitable for your use?
The ellipsis is a good fit when the full text is still available somewhere and the shortened version only needs to help people scan. Typical cases include file names in a list, email subject lines in an inbox view, table cells, navigation labels and card titles. The main benefit is that the underlying content is untouched. The full string remains in the page, so assistive technology, in-page search and copying generally still work with it. The truncation also adapts to the available width as the layout changes.
The key tradeoff is that sighted readers lose the hidden part, and you cannot predict exactly where the cut will fall. The cut point depends on the font, the container width, the zoom level and the user's text settings. If the hidden words carry essential meaning, such as a dosage, a price qualifier, a legal condition, an error message or the distinguishing end of similar file names, truncation can mislead. In those cases, show the full text by letting it wrap, or offer a reliable way to reveal it.
Plain, unstyled text is the better choice when the content will be printed, exported or pasted elsewhere and must read the same everywhere. It is also better when the text is short enough to wrap without harming the layout, and when users must compare or act on the complete wording.
What text-overflow: ellipsis actually changes
This is a presentation change, not a character change. The browser decides at render time which characters fit, hides the rest, and paints an ellipsis glyph in the remaining space. Nothing is removed from the HTML, and no ellipsis character is added to it. That sets it apart from typing or inserting the Unicode horizontal ellipsis character (U+2026) or three periods, which changes the stored text. It also differs from shortening a string in server code or JavaScript, which permanently drops characters from what the page contains.
The word 'ellipsis' is used for several different things, so it helps to keep them apart:
The CSS property value text-overflow: ellipsis is a visual cut-off that leaves the content intact.
The typographic character … (U+2026) is a single stored character that punctuation tools may substitute for three periods.
The class name text-ellipsis in utility frameworks such as Tailwind CSS applies the text-overflow: ellipsis declaration. A related truncate utility combines it with the other properties needed for single-line truncation.
Programmatic truncation, such as cutting a string to a fixed number of characters and appending an ellipsis, alters the data itself.
What it takes to make the ellipsis appear
Setting text-overflow on its own usually does nothing. The property only takes effect when the text actually overflows a block container whose overflow is clipped. For a single line, you typically need three things together: a constrained width, clipped overflow, and no wrapping.
.truncate {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
Common reasons it fails include the following. The element is inline rather than block or inline-block. The element has no width limit, so it simply grows. The element is a flex item that cannot shrink below its content size, which is often fixed with min-width: 0 on the item. Or the element is a table cell in an automatically sized table, where a fixed table layout or a maximum width is usually needed.
Single-line versus multi-line truncation
The text-overflow property handles overflow on a single line. Clamping text to a set number of lines with an ellipsis on the last one is done with line clamping. The widely used form relies on the prefixed -webkit-line-clamp property together with display: -webkit-box and -webkit-box-orient: vertical. An unprefixed line-clamp is defined in the CSS Overflow specification, but browser support has varied. Check current compatibility data before relying on either form, because no compatibility testing was supplied for this review.
.clamp-3 {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
}
Direction, other values and complex characters
The ellipsis is placed at the end edge in the inline direction. In right-to-left text such as Arabic or Hebrew, it therefore appears on the left, and mixed-direction strings follow the bidirectional rendering of the line. The specification also defines a custom string value and a two-value form that can truncate at both the start and the end. Support for these has historically been limited, so treat them as unreliable unless you have confirmed support in the browsers you target.
Because the browser truncates rendered text rather than raw code points, it is generally better placed than naive string slicing to avoid splitting a letter from its combining accent or breaking a multi-code-point emoji. However, this review has no test evidence for specific emoji sequences or scripts. If such content matters, check it in your target browsers. If you truncate text in code instead, cut on grapheme cluster boundaries rather than by code unit or code point, or you risk leaving broken accents or partial emoji.
| Approach | What is stored | What sighted users see | Copy/paste result | Adapts to width |
| CSS text-overflow: ellipsis | Full original text | Text cut at the box edge with … | Generally the full selected text | Yes |
| CSS line clamping | Full original text | Several lines, last one ending in … | Generally the full selected text | Yes |
| Inserting the … character (U+2026) | Text containing the … character | Exactly what is stored | Includes the … character | No |
| Truncating the string in code | Shortened text plus an appended ellipsis | Exactly what is stored | Only the shortened text | No |
Will the text stay readable and usable after copying or sharing?
Since the hidden characters remain in the page, selecting and copying a CSS-truncated element typically copies the full text, not the ellipsis. The ellipsis is drawn by the browser and is not part of the content. Selecting a partly hidden line can feel awkward, because users cannot see what they are selecting. Exact selection behavior can differ between browsers, and no scoped tests were provided here.
Sharing works the same way. Wherever the raw text goes, such as a pasted message, a feed or a search index, it travels without any truncation, because the truncation exists only in your stylesheet. Crawlers that read the page content receive the full text. In-page find features can usually match hidden words, but the matched text may sit in the clipped area where the user cannot see it.
For assistive technology, CSS truncation is generally seen as preferable to cutting the text itself. Screen readers work from the document content and so typically announce the complete string. This review did not have documentation or test results for any specific screen reader, so confirm behavior with the tools your audience uses. The larger accessibility risk affects sighted users. People who zoom in, enlarge text or use narrow screens see more truncation, and the hidden content may be impossible for them to reach.
Relying on the title attribute to show the full text on hover is a weak fallback. Hover tooltips are generally not available to keyboard-only or touch users and are inconsistently exposed to assistive technology. Better options include letting the text wrap at larger sizes, providing an expand control, linking to a detail view that shows the complete text, or using an accessible tooltip that opens on focus as well as on hover.
When you need a plain-text equivalent
- When the truncated text is the only place the information appears and the hidden part matters for decisions.
- When content is exported, printed, emailed or syndicated and will be read without your stylesheet. It will then show in full, so make sure the layout can handle that.
- When you have truncated the text in code. The original full string should then stay available in the page or one step away, because the cut text cannot be recovered by copying.
- When a typographic ellipsis character has been inserted for style. Keep it only where the omission is real, since it changes the stored wording and may affect exact-match searches.
Gaps in this review
No browser compatibility measurements, screen reader test results or destination-specific copy/paste tests were provided. Statements about copying, assistive technology and search describe the general mechanism, where content remains in the page while CSS changes only its appearance. They are not verified observations for particular browsers, devices or platforms. Before shipping, check support for line clamping, two-value or custom-string text-overflow, and right-to-left or emoji-heavy content in the environments you actually target.