CSS3 text-overflow 属性

来源:互联网 发布:淘宝店铺旺旺在哪里 编辑:程序博客网 时间:2024/06/01 09:28

CSS3 text-overflow 属性

定义和用法

text-overflow 属性规定当文本溢出包含元素时发生的事情。

默认值:clip继承性:no版本:CSS3JavaScript 语法:object.style.textOverflow="ellipsis"

语法

text-overflow: clip|ellipsis|string;

值描述测试clip修剪文本。测试ellipsis显示省略符号来代表被修剪的文本。测试string使用给定的字符串来代表被修剪的文本。

实例

使用 text-overflow 属性:

<p>下面两个 div 包含无法在框中容纳的长文本。正如您所见,文本被修剪了。</p><p>这个 div 使用 "text-overflow:ellipsis" :</p><div class="test" style="text-overflow:ellipsis;">This is some long text that will not fit in the box</div><p>这个 div 使用 "text-overflow:clip":</p><div class="test" style="text-overflow:clip;">This is some long text that will not fit in the box</div>



转自w3school

0 0
原创粉丝点击