DOCUMENT / 文档

HTML DOM Style textOverflow 属性

HTML DOM Style textOverflow 属性

Style textOverflow  属性

Style 对象

实例

改变 textOverflow 属性:

document.getElementById("myDIV").style.textOverflow="ellipsis";
尝试一下 »

定义和用法

textOverflow 属性规定当文本溢出包含它的元素,应该发生什么。

浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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

语法

返回 textOverflow 属性:

object.style.textOverflow

设置 textOverflow 属性:

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

属性值

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

技术细节

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

相关文章

CSS 参考手册:text-overflow 属性

Style 对象