天天看点

Style textOverflow 属性

Style 对象

实例

改变 textOverflow 属性:

document.getElementById("myDIV").style.textOverflow="ellipsis";

定义和用法

textOverflow 属性规定当文本溢出包含它的元素,应该如何显示文本。

浏览器支持

Style textOverflow 属性
Style textOverflow 属性
Style textOverflow 属性
Style textOverflow 属性
Style textOverflow 属性

所有主流浏览器都支持 textOverflow 属性。

语法

返回 textOverflow 属性:

object.style.textOverflow

设置 textOverflow 属性:

object.style.textOverflow="clip|ellipsis|string|initial|inherit"

属性值

描述
clip 默认值。裁剪文本。
ellipsis 使用省略符号("...")来代表被裁剪的文本。
string 使用给定的字符串来代表被裁剪的文本。
initial 设置该属性为它的默认值。请参阅 initial。
inherit 从父元素继承该属性。请参阅 inherit。

技术细节

默认值:
返回值 字符串,表示元素的 text-overflow 属性。
CSS 版本 CSS3

相关文章

CSS 参考手册:text-overflow 属性

Style 对象