企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# text-overflow **版本:CSS3** 继承性:无 ### 语法: **text-overflow** : clip | ellipsis ### 取值: clip:不显示省略标记(...),而是简单的裁切。ellipsis:当对象内文本溢出时显示省略标记(...) ### 说明: 1. 设置或检索是否使用一个省略标记(...)标示对象内文本的溢出。对应的脚本特性为textOverflow。 1. text-overflow属性仅是注解,当文本溢出时是否显示省略标记。并不具备其它的样式属性定义。要实现溢出时产生省略号的效果还须定义:强制文本在一行内显示(white-space:nowrap)及溢出内容为隐藏(overflow:hidden),只有这样才能实现溢出文本显示省略号的效果。 ### 兼容性: ### text-overflow : clip <table><thead><tr><th class="type">类型</th> <th class="type_ie"><img src="https://box.kancloud.cn/2015-09-02_55e5d385d43a3.png" alt="IE" />Internet Explorer</th> <th class="type_firefox"><img src="https://box.kancloud.cn/2015-09-02_55e5d385dd7fc.png" alt="Firefox" />Firefox</th> <th class="type_chrome"><img src="https://box.kancloud.cn/2015-09-02_55e5d385e7c96.png" alt="Chrome" />Chrome</th> <th class="type_opera"><img src="https://box.kancloud.cn/2015-09-02_55e5d385ef1fd.png" alt="Opera" />Opera</th> <th class="type_safari"><img src="https://box.kancloud.cn/2015-09-02_55e5d38611f8d.png" alt="Safari" />Safari</th> </tr></thead><tbody><tr><td rowspan="4" class="version">版本</td> <td class="support yes"><span>(√)</span>IE6</td> <td class="support yes"><span>(√)</span>Firefox 2.0</td> <td class="support yes"><span>(√)</span>Chrome 1.0.x</td> <td class="support yes"><span>(×)</span>Opera 9.63</td> <td class="support yes"><span>(√)</span>Safari 3.1</td> </tr><tr><td class="support yes"><span>(√)</span>IE7</td> <td class="support yes"><span>(√)</span>Firefox 3.0</td> <td class="support yes"><span>(√)</span>Chrome 2.0.x</td> <td></td> <td class="support yes"><span>(√)</span>Safari 4</td> </tr><tr><td class="support yes"><span>(√)</span>IE8</td> <td class="support yes"><span>(√)</span>Firefox 3.5</td> <td></td> <td></td> <td></td> </tr><tr><td></td> <td></td> <td></td> <td></td> <td></td> </tr></tbody></table> ### text-overflow : ellipsis <table><thead><tr><th class="type">类型</th> <th class="type_ie"><img src="https://box.kancloud.cn/2015-09-02_55e5d3861a1f9.png" alt="IE" />Internet Explorer</th> <th class="type_firefox"><img src="https://box.kancloud.cn/2015-09-02_55e5d38621345.png" alt="Firefox" />Firefox</th> <th class="type_chrome"><img src="https://box.kancloud.cn/2015-09-02_55e5d38629e9e.png" alt="Chrome" />Chrome</th> <th class="type_opera"><img src="https://box.kancloud.cn/2015-09-02_55e5d38632557.png" alt="Opera" />Opera</th> <th class="type_safari"><img src="https://box.kancloud.cn/2015-09-02_55e5d3863a44f.png" alt="Safari" />Safari</th> </tr></thead><tbody><tr><td rowspan="4" class="version">版本</td> <td class="support yes"><span>(√)</span>IE6</td> <td class="support no"><span>(×)</span>Firefox 2.0</td> <td class="support yes"><span>(√)</span>Chrome 1.0.x</td> <td class="support no"><span>(×)</span>Opera 9.63</td> <td class="support yes"><span>(√)</span>Safari 3.1</td> </tr><tr><td class="support yes"><span>(√)</span>IE7</td> <td class="support no"><span>(×)</span>Firefox 3.0</td> <td class="support yes"><span>(√)</span>Chrome 2.0.x</td> <td></td> <td class="support yes"><span>(√)</span>Safari 4</td> </tr><tr><td class="support yes"><span>(√)</span>IE8</td> <td class="support no"><span>(×)</span>Firefox 3.5</td> <td></td> <td></td> <td></td> </tr><tr><td></td> <td></td> <td></td> <td></td> <td></td> </tr></tbody></table> ### 示例: ![](https://box.kancloud.cn/2015-09-02_55e5d38644798.png) <!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> 复制代码 Copyright © 2009 [Tencent ISD webteam](http://webteam.tencent.com/). All Rights Reserved ### 快速跳转 - [语法](# "跳转到“语法”") - [取值](# "跳转到“取值”") - [说明](# "跳转到“说明”") - [兼容性](# "跳转到“兼容性”") - [示例](# "跳转到“示例”")