我有一个带有多个
标签的div,div是固定的宽度和高度,我想用“……”替换溢出父版本的文本。
one one one one one one one one one one one one
two two two two two two two two two two two two
three three three three three three three three
four four four four four four four four four four
five five five five five five five five five five
six six six six six six six six six six six six six
在某些时候,文本溢出父文件,此时我想用“…”替换溢出的单词。
像这样:
___________________________ | one one one one one one | | two two two two two two | | two two | | three three three three | | three three three | | four four four four four| | four | | five five five five ... | |_________________________|
事情就是文字水平包裹就好了。 一旦它太长就会被垂直剪裁,这很好。 我需要的是完成删除半可见的行并用“……”替换它前面的最后一个单词
我猜它不可能通过CSS所以我不介意尝试使用jQuery。
非常感谢你的帮助!
这是我经常使用的解决方案:
纯CSS中的多行省略号
还有一个jQuery插件: dotdotodt
以上就是jQuery教程分享如何用省略号“……”替换第一个溢出元素相关内容,想了解更多jQuery开发(异常处理)及jQuery教程关注(编程笔记)。