The text-overflow property sets how hidden overflow text is signaled in the inline direction—usually a hard cut (clip) or an ellipsis (ellipsis).
It does not create overflow by itself. Pair it with overflow (not visible) and, for a single line, white-space: nowrap. It is not inherited. The initial value is clip.
Limited availability Custom string & two values
A custom <string> (for example text-overflow: " [..]") and reliable two-value syntax are mainly supported in Firefox. Prefer clip / ellipsis for cross-browser work.
Experimentalfade
fade / fade() appear in the modern syntax but are not ready for production. Stick to clip and ellipsis.
Set white-space: nowrap so the text stays on one line.
Set overflow: hidden (or scroll / auto—not visible).
Set text-overflow: ellipsis (or leave clip).
Piece
Required?
Role
Constrained width
Yes
Something must overflow
white-space: nowrap
Yes (single line)
Prevents wrapping so text can overflow
overflow ≠ visible
Yes
Clips the overflowing content
text-overflow
Yes
clip or ellipsis
Try it
Live Preview
The sample already has overflow: hidden, white-space: nowrap, and a fixed width. Switch between clip and ellipsis.
Narrow the idea: long labels, table cells, and card titles often use ellipsis.
Overflow preview
This is a very long label that will not fit in this narrow box.
text-overflow: ellipsis
Code
CSS Examples
Each snippet keeps the CSS focused on text-overflow plus the two partners it needs. Use Try It Yourself for a live editor.
Example 1 — Classic Ellipsis
The everyday single-line truncate pattern for titles and labels.
CSS
<style>
p {
width: 12rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
<p>This is a very long label that will not fit.</p>
Same overflow trio. Width, nowrap, and hidden still apply.
Set clip. Extra characters disappear at the edge.
No marker. Readers get no … cue that more text exists.
Default behavior. Omitting text-overflow looks the same.
Example 3 — Clip vs Ellipsis
Put both side by side so the difference is obvious.
CSS
<style>
p {
width: 12rem;
white-space: nowrap;
overflow: hidden;
}
.clip {
text-overflow: clip;
}
.ellipsis {
text-overflow: ellipsis;
}
</style>
<p class="clip">This is a very long label that will not fit.</p>
<p class="ellipsis">This is a very long label that will not fit.</p>