text-overflow 属性规定当文本溢出包含元素时发生的事情。
语法:text-overflow: clip|ellipsis|string;
clip 修剪文本。
ellipsis 显示省略符号来代表被修剪的文本。
注意:text-overflow:ellipsis;要与white-space:nowrap; 和overflow:hidden; 一起使用才有效果。因为text-overflow只是用来说明[b]文字溢出时用什么方式显示[/b],要实现溢出时产生省略号的效果,还须定义[b]强制文本在一行内显示[/b](white-space:nowrap)及[b]溢出内容为隐藏[/b](overflow:hidden),只有这样才能实现溢出文本显示省略号的效果
效果:[img]http://dl2.iteye.com/upload/attachment/0105/4136/93db03df-2cb2-3b15-96b6-e199ce39a168.png[/img]
效果:[img]http://dl2.iteye.com/upload/attachment/0105/4138/5e36a1ed-8b9e-39ca-b17e-23a2c27779af.png[/img]
语法:text-overflow: clip|ellipsis|string;
clip 修剪文本。
ellipsis 显示省略符号来代表被修剪的文本。
注意:text-overflow:ellipsis;要与white-space:nowrap; 和overflow:hidden; 一起使用才有效果。因为text-overflow只是用来说明[b]文字溢出时用什么方式显示[/b],要实现溢出时产生省略号的效果,还须定义[b]强制文本在一行内显示[/b](white-space:nowrap)及[b]溢出内容为隐藏[/b](overflow:hidden),只有这样才能实现溢出文本显示省略号的效果
<div class="test" >This is some long text that will not fit in the box</div>
div.test{
white-space:nowrap;
overflow:hidden;
text-overflow:clip;
width:12em;
border:1px solid #000000;
}
效果:[img]http://dl2.iteye.com/upload/attachment/0105/4136/93db03df-2cb2-3b15-96b6-e199ce39a168.png[/img]
div.test{
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
width:12em;
border:1px solid #000000;
}
效果:[img]http://dl2.iteye.com/upload/attachment/0105/4138/5e36a1ed-8b9e-39ca-b17e-23a2c27779af.png[/img]