【发布时间】:2013-04-20 05:42:11
【问题描述】:
这是我的css sn-p
.test{
width:150px;
height:60px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
}
它的作用是……
the quick brown fo...
我想要的是
the quick brown fox
jumps over the lazy
dog. the quick br...
有没有办法只用 CSS 来做到这一点?还是我需要为此使用javascript。如果需要javascript,任何人都可以教我怎么做?谢谢!
更新
我尝试删除 white-space: nowrap; 并添加 overflow-y: hidden; 它给了我 3 行布局但没有省略号
.test{
width:150px;
height:60px;
overflow-y: hidden;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
}
【问题讨论】:
-
仅使用 css 是不可能的...我使用这个插件 plugins.jquery.com/ellipsis
-
我明白了,现在就试试这个插件..
-
把你的代码放在小提琴里然后发给你..
标签: javascript ellipsis css