Change the textOverflow property:
document.getElementById("myDIV").style.textOverflow = "ellipsis";
Try it Yourself »
The textOverflow property specifies what should happen when text overflows the containing element.
Property | |||||
---|---|---|---|---|---|
textOverflow | Yes | Yes | Yes | Yes | Yes |
Return the textOverflow property:
object.style.textOverflow
Set the textOverflow property:
object.style.textOverflow = "clip|ellipsis|
string|initial|inherit"
Value | Description |
---|---|
clip | Default value. Clips the text |
ellipsis | Render an ellipsis ("...") to represent clipped text |
string | Render the given string to represent clipped text |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Default Value: | clip |
---|---|
Return Value: | A String, representing the text-overflow property of an element |
CSS Version | CSS3 |
CSS reference: text-overflow property
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!