English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS reference manual

CSS @rules

CSS attribute大全

CSS3 text-Usage and examples of overflow property

text-The overflow CSS property determines when the text container overflows to be visible (instead of hidden)overflowHow to display text content when the block container element of

The following table provides usage descriptions and version histories of this property, as well as the syntax of its usage in JavaScript scripts.

Default value:clip
Applies to:Block-level container
Inheritance:None
Animated by:No.See also Animation properties.
Version: CSS3new feature
JavaScript syntax:object.style.textOverflow="ellipsis"

Note:For example, if the element is set to nowrap and the whitespace or single word is too long to fit, the text may overflow, resulting in text overflow.

text-The syntax of overflow usage

The syntax of this attribute is as follows:

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

The following example demonstrates how to use text-overflow attribute.

  p {
 overflow: hidden;
 white-space: nowrap;
   text-overflow: ellipsis;
  }
Test see‹/›

Attribute Value

The table below describes the value of this attribute.

ValueDescription
clipTruncation is suitable for text content. Characters may only be partially rendered.
ellipsisUse the ellipsis character ('...') to replace the truncated text.
stringUse the given string to represent the truncated text. This string is displayed in the content area, thus shortening the size of the displayed text. If there is not enough space to display the string, it will be truncated.
initialSet this property to its default value.
inheritIf specified, the associated element adopts its parent element text-Overflow property values.

Browser Compatibility

text-Browser compatibility of overflow attribute, the numbers in the table below represent the minimum version number of the browsers that support this attribute; all mainstream browsers support this attribute.

  • Firefox 7+

  • Google Chrome1+

  • Internet Explorer 6+

  • Apple Safari 1+

  • Opera 9+

Note: Internet Explorer supports-ms-text-overflow can be used as a synonym in the prefixed version text-overflow. Opera 9and10Supports prefixed versions-o-text-overflow.

Read more

Please refer to the tutorials related to the following content:CSS OverflowandCSS Text.

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