使用jQuery在有限标签中显示文本 [英] Use jQuery display a text in a limited label

查看:149
本文介绍了使用jQuery在有限标签中显示文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个标签,它的长度有限。我想这样做:当文本的长度比标签长,文本的结束词将替代...

I have a label and it's length is limited. I want to do this: when the text's length is longer than the label, the end words of text will instead of "..."

如何做到这一点与jQuery或者JavaScript?

How can do this with jQuery or JavaScript?

我不知道这个,有什么建议吗?

I have no idea of this, any advise?

推荐答案

您可以不使用JS。

label{
 white-space: nowrap;
 text-overflow: ellipsis;
 overflow:hidden;
}

这篇关于使用jQuery在有限标签中显示文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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