text-overflow : clip | ellipsis
text-overflow 文本溢出显示省略标记【CSS3.0参考手册】
语法:
取值:
- clip:
- 不显示省略标记(...),而是简单的裁切。
- ellipsis:
- 当对象内文本溢出时显示省略标记(...)
说明:
- 设置或检索是否使用一个省略标记(...)标示对象内文本的溢出。对应的脚本特性为textOverflow。
- text-overflow属性仅是注解,当文本溢出时是否显示省略标记。并不具备其它的样式属性定义。要实现溢出时产生省略号的效果还须定义:强制文本在一行内显示(white-space:nowrap)及溢出内容为隐藏(overflow:hidden),只有这样才能实现溢出文本显示省略号的效果。
兼容性:
text-overflow : clip
| 类型 | |||||
|---|---|---|---|---|---|
| 版本 | (√)IE6 | (√)Firefox 2.0 | (√)Chrome 1.0.x | (×)Opera 9.63 | (√)Safari 3.1 |
| (√)IE7 | (√)Firefox 3.0 | (√)Chrome 2.0.x | (√)Safari 4 | ||
| (√)IE8 | (√)Firefox 3.5 | ||||
text-overflow : ellipsis
| 类型 | |||||
|---|---|---|---|---|---|
| 版本 | (√)IE6 | (×)Firefox 2.0 | (√)Chrome 1.0.x | (×)Opera 9.63 | (√)Safari 3.1 |
| (√)IE7 | (×)Firefox 3.0 | (√)Chrome 2.0.x | (√)Safari 4 | ||
| (√)IE8 | (×)Firefox 3.5 | ||||
示例:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="utf-8" />
<meta name="robots" content="all" />
<meta name="author" content="Tencent-ISRD" />
<meta name="Copyright" content="Tencent" />
<title>text-overflow</title>
</head>
<body>
<style type="text/css">
.test_demo_clip{text-overflow:clip; overflow:hidden; white-space:nowrap; width:200px; background:#ccc;}
.test_demo_ellipsis{text-overflow:ellipsis; overflow:hidden; white-space:nowrap; width:200px; background:#ccc;}
</style>
<h2>text-overflow : clip </h2>
<div class="test_demo_clip">
不显示省略标记,而是简单的裁切条
</div>
<h2>text-overflow : ellipsis </h2>
<div class="test_demo_ellipsis">
当对象内文本溢出时显示省略标记
</div>
</body>
</html>
来源://作者:/更新时间:2013-01-21
顶
踩
相关文章:
- resize 调节元素尺寸大小【CSS3.0参考手册】
- text-shadow 文字阴影及模糊效果【CSS3.0参考手册】
- Multiple backgrounds 多重背景图象【CSS3.0参考手册
- background-size 设置背景图片的大小【CSS3.0参考手
- background-clip 指定区域向外裁剪背景【CSS3.0参考手
- background-origin 指定区域显示背景【CSS3.0参考手册
- box-shadow[css3.0参考手册]
- Border-radius[css3.0参考手册]
- Border-image[css3.0参考手册]
- Border-color [css3.0参考手册]




![box-shadow[css3.0参考手册]](/d/file/webkaifa/CSS/2012-11-09/67f47fb6ec0346889fbde7fd4dab0eef.jpg)