案例:CSS3 案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<style> 
5
div.test
6
{
7
white-space:nowrap; 
8
width:12em; 
9
overflow:hidden; 
10
border:1px solid #000000;
11
}
12
</style>
13
</head>
14
<body>
15
16
<p>下面两个 div 包含无法在框中容纳的长文本。正如您所见,文本被修剪了。</p>
17
18
<p>这个 div 使用 "text-overflow:ellipsis" :</p>
19
20
<div class="test" style="text-overflow:ellipsis;">This is some long text that will not fit in the box</div>
21
22
<p>这个 div 使用 "text-overflow:clip":</p>
23
24
<div class="test" style="text-overflow:clip;">This is some long text that will not fit in the box</div>
25
26
</body>
27
</html>
28