前端之家收集整理的这篇文章主要介绍了
jQuery实现文字超过1行、2行或规定的行数时自动加省略号的方法,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
本文实例讲述了jQuery实现文字超过1行、2行或规定的行数时自动加省略号的方法。分享给大家供大家参考,具体如下:
<
Meta charset="UTF-8">
www.jb51.cc jQuery自动添加省略号
You probably can't do it (currently?) without a fixed-width font like Courier. With
a fixed-width font every letter occupies the same horizontal space,so you could
probably count the letters and multiply the result with the current font size in
ems or exs. Then you would just have to test how many letters fit on one line,and
then break it up.