是否有可能实现溢出的效果:用javascript或css省略? [英] Is it possible to implement the effect of overflow:ellipsis with javascript or css?

查看:69
本文介绍了是否有可能实现溢出的效果:用javascript或css省略?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

溢出发生时,我想显示 ...

但遗憾的是在css中只有溢出:隐藏这是接近但不完全符合我想要的。

but sadly in css there is only overflow:hidden which is near but not exact what I want.

是否可以实现它?

推荐答案

text-overflow: ellipsis;

参见 http://www.quirksmode.org/css/textoverflow.html https://developer.mozilla.org/en/CSS/text-overflow 。但是,不支持Firefox。

See http://www.quirksmode.org/css/textoverflow.html and https://developer.mozilla.org/en/CSS/text-overflow. Doesn't support Firefox, however.

编辑:有一个 jQuery插件。安装后,请致电

There's a jQuery plugin for this. After you have installed it, call

$(thatElement).ellipsis();

激活样式。请参见 http://jsbin.com/acuti3 。除此之外还有一个其他一些jQuery插件

to activate the style. See http://jsbin.com/acuti3. There are a bunch of other jQuery plugins for besides this.

这篇关于是否有可能实现溢出的效果:用javascript或css省略?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆