每天CSS学习之text-overflow

text-overflow是CSS3的一个属性,其作用是当文本溢出包含它的元素时,应该裁剪还是将多余的字符用省略号来表示。

该属性一般和overflow:hidden属性一起使用。

text-overflow: clip|ellipsis|string

1、clip:修剪文本。即将溢出的文本裁剪掉。如以下例子,如果需要显示This is an Action,则:

white-space:nowrap; 
text-overflow:clip;
overflow:hidden;

结果:

2、ellipsis: 当文本溢出时,用省略号代替溢出的文本。如:

white-space:nowrap; 
text-overflow:ellipsis;
overflow:hidden;

结果:

原文地址:https://www.cnblogs.com/williamwsj/p/7360471.html