如何限制span或td标签中的最大字符 [英] How to limit maximum characters in span or td tag

查看:625
本文介绍了如何限制span或td标签中的最大字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个CSS类".views",并为其指定了固定的宽度和高度.我已经将此类应用于标记.我希望当我放置一些比其特定宽度长的文本时,该文本不超过其宽度,并在其结尾处自动显示该符号"....",因为它仍在继续.

我怎样才能做到这一点?

I have made a css class ".views" and I have given it the fixed width and height. I have applied this class to a tag. I want when I put some text which is longer than its specific width the text do not cross its width and automatically shows at its end this symbol "...." as it is continue yet.

How can I do that? Would some one help me plz?

推荐答案

您需要在views类上设置CSS属性text-overflow: ellipsis.您还必须遵循一些非常具体的步骤来确保此属性正常运行,请参见此页面 [ ^ ]获取说明.

请注意,此技术在Firefox中不起作用.如果您希望支持Firefox,可以尝试此jQuery插件 [
You need to set the CSS property text-overflow: ellipsis on your views class. There are some very specific steps you must also follow to ensure this property works, see this page[^] for instructions.

Note that this technique does not work in Firefox. If you wish to support Firefox, you could try this jQuery plugin[^].


这篇关于如何限制span或td标签中的最大字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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