CSS PROPERTIES
Expand All|Collapse All
CSS AT-RULES
SPONSORED LINKS

CSS3 text-overflow Property

Topic: CSS3 Properties Reference« Prev|Next »

Description

The text-overflow CSS property determines how the text content will be displayed, when it overflows the block container element that has overflow other than visible.

The following table summarizes the usages context and the version history of this property.

Default value: clip
Applies to: Block containers
Inherited: No
Animatable: No. See animatable properties.
Version: New in CSS3
 

Note:Text can overflow, when it is prevented from wrapping e.g. due to white space set to nowrap for the containing element or a single word is too long to fit.


Syntax

The syntax of the property is given with:

text-overflow clip | ellipsis | string | initial | inherit

The example below shows the text-overflow property in action.

  • p {
  •     overflow: hidden;
  •     white-space: nowrap;
  •     text-overflow: ellipsis;
  • }

Property Values

The following table describes the values of this property.

Value Description
clip Clip text as appropriate for the text content. Characters may be only partially rendered.
ellipsis Render an ellipsis character ('...', U+2026) to represent clipped text.
string Render the given string to represent clipped text. The string is displayed inside the content area, shortening more the size of the displayed text. If there are not enough places to display string, they are clipped.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element text-overflow property.

Browser Compatibility

The text-overflow property is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 7+
  • Google Chrome 1+
  • Internet Explorer 6+
  • Apple Safari 1+
  • Opera 9+
 

Note:Internet Explorer supports the prefixed version -ms-text-overflow that can be used as a synonym for text-overflow. Opera 9 and 10 supports the prefixed version, -o-text-overflow.


Further Reading

See tutorial on: CSS Overflow, CSS Text.

Text-related properties: letter-spacing, text-align, text-decoration, text-indent, text-shadow, text-transform, white-space, word-spacing.

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.