CSS3 text-overflow Property
Example
Using the text-overflow property:
div
.test
{
text-overflow:
ellipsis
;
}
Try it »
There are more examples at the bottom of this page.
Browser support
The numbers in the table indicate the first browser version that supports this property.
| property | |||||
|---|---|---|---|---|---|
| text-overflow | 4.0 | 6.0 | 7.0 | 3.1 | 11.0 |
| 9.0 -o- |
Property definition and usage
The text-overflow property specifies how text should be displayed when it overflows the element containing it. After overflow, the text can be clipped, show an ellipsis (...), or display a custom string (not supported by all browsers).
text-overflow needs to be used together with the following two properties:
| Default value: | auto |
|---|---|
| Inherited: | no |
| Animatable: | support. Read about animatable |
| Version: | 3 |
| JavaScript syntax: | object.style.textOverflow="ellipsis" Try it |
Syntax
text-overflow: clip|ellipsis|string|initial|inherit;
| Value | Description |
|---|---|
| clip | Clips the text. |
| ellipsis | Shows an ellipsis ... to represent the clipped text. |
| string | Uses the given string to represent the clipped text. |
| initial | Sets the property to its default value.Read about initial |
| inherit | Inherits the property value from the parent element. Read about inherit |
More examples
Show the entire text on hover
This example demonstrates how to display the entire text when the mouse hovers over the element.
Related Articles
CSS3 tutorial: CSS3 Text Effects