CSS text-overflow Property

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

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.

Experimental fade

fade / fade() appear in the modern syntax but are not ready for production. Stick to clip and ellipsis.

CSS Syntax

syntax.css
text-overflow: clip | ellipsis | initial | inherit;

Study these Baseline keywords first. Custom strings and two-value forms are Limited—see the notes above.

Property Values

ValueDescriptionTry it
clipDefault. Cuts text at the content edge (may mid-character)Try it
ellipsisShows … for clipped text inside the content areaTry it
initialResets to clipTry it
inheritTakes the parent’s value (property is not inherited by default)Try it

How to Use text-overflow

Create a single-line overflow first, then choose how to signal the cut.

  1. Give the box a width (or max-width).
  2. Set white-space: nowrap so the text stays on one line.
  3. Set overflow: hidden (or scroll / auto—not visible).
  4. Set text-overflow: ellipsis (or leave clip).
PieceRequired?Role
Constrained widthYesSomething must overflow
white-space: nowrapYes (single line)Prevents wrapping so text can overflow
overflow ≠ visibleYesClips the overflowing content
text-overflowYesclip or ellipsis

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

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>
Try It Yourself

How It Works

  1. Limit width. width: 12rem makes the text too long for the box.
  2. Block wrapping. white-space: nowrap keeps one line.
  3. Hide overflow. overflow: hidden clips the extra text.
  4. Signal the cut. text-overflow: ellipsis shows ….

Example 2 — Default Clip

Same overflow setup, but text is cut with no ellipsis.

CSS
<style>
  p {
    width: 12rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
  }
</style>

<p>This is a very long label that will not fit.</p>
Try It Yourself

How It Works

  1. Same overflow trio. Width, nowrap, and hidden still apply.
  2. Set clip. Extra characters disappear at the edge.
  3. No marker. Readers get no … cue that more text exists.
  4. 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>
Try It Yourself

How It Works

  1. Share the base. Both paragraphs use the same width and overflow rules.
  2. Vary one property. Classes set clip or ellipsis.
  3. Compare the end. Only the second line shows ….
  4. Choose for UX. Ellipsis is clearer when truncated text matters.

Edge Cases & Pitfalls

No ellipsis? Check these before blaming the keyword.

trio

Needs overflow + nowrap + width

text-overflow alone never truncates. Missing any partner means no visible effect.

direction

Inline overflow only

It affects overflow in the inline axis, not text that spills out the bottom of a multi-line box.

edit

Editable controls may drop the ellipsis

On focused input, textarea, or contenteditable, browsers often treat ellipsis like clip so text stays editable.

lines

Not multi-line by itself

For a multi-line clamp with …, look at line-clamp. This property is the single-line signal.

space

Tiny boxes can clip the ellipsis

If there is not enough room for …, the ellipsis itself can be clipped.

Browser Support

text-overflow is a browser layout property. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

text-overflow

clip and ellipsis are interoperable across modern browsers since about July 2015. Custom <string> values remain Limited (mainly Firefox).

97% clip / ellipsis
Google Chrome 4+
Full
Mozilla Firefox 7+
Full
Apple Safari 3.1+
Full
Microsoft Edge 12+
Full
Opera 15+
Full
Samsung Internet 4+
Full
Internet Explorer 6+
Full
text-overflow (clip, ellipsis) Widely supported

Bottom line: Safe for production with clip and ellipsis. Avoid relying on custom strings, two-value syntax, or fade in cross-browser CSS.

Key Takeaways

  • Role: signal how clipped inline overflow looks (clip or ellipsis).
  • Trio: constrained width + white-space: nowrap + overflow: hidden.
  • Default: clip. Not inherited.
  • Tip: use ellipsis for UI labels; leave multi-line clamps to line-clamp.

One line: text-overflow only chooses the overflow cue after width, nowrap, and overflow already hide the extra text.

Frequently Asked Questions

It sets how overflowing inline text is signaled when it is clipped—usually a hard cut (clip) or an ellipsis (…).
The initial value is clip. Extra text is cut off with no ellipsis.
You need overflow set to a non-visible value (usually hidden), white-space: nowrap for a single line, and a constrained width or max-width.
No. Apply it on the element whose text should truncate.
A <string> value is Limited availability—mainly Firefox. Prefer ellipsis for cross-browser work.
clip and ellipsis are Baseline Widely available (interoperable since about July 2015). It is a browser layout property, not a Node.js feature.

Next: text-shadow

Learn how to add shadow effects to text.

text-shadow tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful