XML technologies / CSS / Advanced websites with CSS / CSS property reference / text-overflow

(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)

The property text-overflow is not included in the CSS specification and describes how an element handles overflowing text (see overflow). It affects only an element’s width (or its height for vertically written languages).

Since the property takes effect only when overflowing content is clipped, overflow must not be declared with visible.

Inherited: no

See also: overflow, white-space, width

Values

This property accepts either of the following constants:

  • clip: The text is clipped.

  • ellipsis: The text is clipped and an (…) character is appended to the clipped section.

Default value: clip

Compatibility

CSS version: not part of the CSS specification

Works only in Internet Explorer for Windows from version 6.

Example

The following rule keeps text in table cells from wrapping as long as it fits. Otherwise, it is clipped and a (...) marker is appended:

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

  

 

 

 

back to top