Use of the text-overflow property:
div
{
white-space: nowrap;
overflow:
hidden;
text-overflow: ellipsis;
}
Try it Yourself »
Definition text-overflow
Подработка: Перевод страницы
The text-overflow property specifies how overflowed content that is not displayed should be signaled to the user. It can be clipped, display an ellipsis (...), or display a custom string.
Both of the following properties are required for text-overflow:
- white-space: nowrap;
- overflow: hidden;
| Default value: | clip |
|---|---|
| Inherited: | no |
| Animatable: | no. Read about animatable |
| Version: | CSS3 |
| JavaScript syntax: | object.style.textOverflow="ellipsis" Try it |
Browser Support text-overflow
The numbers in the table specify the first browser version that fully supports the property.
Numbers followed by -o- specify the first version that worked with a prefix.
| Property | |||||
|---|---|---|---|---|---|
| text-overflow | 4.0 | 6.0 | 7.0 | 3.1 | 11.0 9.0 -o- |
CSS Syntax text-overflow
text-overflow: clip|ellipsis|string|initial|inherit;
Property Values text-overflow
| Value | Description | Demo |
|---|---|---|
| clip | Default value. The text is clipped and not accessible | Demo ❯ |
| ellipsis | Render an ellipsis ("...") to represent the clipped text | Demo ❯ |
| string | Render the given string to represent the clipped text | |
| initial | Sets this property to its default value. Read about initial | |
| inherit | Inherits this property from its parent element. Read about inherit |
More Examples text-overflow
Text-overflow with a hover effect (show entire text on hover):
div.a {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
div.a:hover {
overflow: visible;
}
Try it Yourself »
Related Pages text-overflow
CSS tutorial: CSS Text Effects
HTML DOM reference: textOverflow property