案例: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
13
div.test:hover
14
{
15
text-overflow:inherit;
16
overflow:visible;
17
}
18
</style>
19
20
</head>
21
22
<body>
23
24
<p>如果您把光标移动到下面两个 div 上,就能够看到全部文本。</p>
25
26
<p>这个 div 使用 "text-overflow:ellipsis" :</p>
27
28
<div class="test" style="text-overflow:ellipsis;">This is some long text that will not fit in the box</div>
29
30
<p>这个 div 使用 "text-overflow:clip":</p>
31
32
<div class="test" style="text-overflow:clip;">This is some long text that will not fit in the box</div>
33
34
</body>
35
</html>
36