css text-overflow属性


  翻译结果:

text

英 [tekst]   美 [tɛkst]  

n.文本,原文;课文,教科书;主题;版本

v.发短信

overflow

英 [ˌəʊvəˈfləʊ]   美 [ˌoʊvərˈfloʊ]  

vt.& vi.溢出,淹没;挤满,充满;洋溢;资源过剩

n.泛滥,溢出物;溢流管;充溢,过多;超出额

vi.泛滥,溢出;充溢

adj.溢出的,满出的

css text-overflow属性 语法

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

语法:text-overflow: clip|ellipsis|string

说明:clip    修剪文本。        ellipsis    显示省略符号来代表被修剪的文本。   string    使用给定的字符串来代表被修剪的文本。    

注释:所有主流浏览器都支持 text-overflow 属性。

css text-overflow属性 示例

<!DOCTYPE html>
<html>
<head>
<style> 
div.test
{
white-space:nowrap; 
width:12em; 
overflow:hidden; 
border:1px solid #000000;
}
</style>
</head>
<body>
<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>
</body>
</html>
运行实例 »

点击 "运行实例" 按钮查看在线实例

热门推荐

目录

首页

视频

问答