CSS css3 是否可以垂直文本溢出?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7004006/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 01:13:06  来源:igfitidea点击:

Is vertical text-overflow possible with css3?

css

提问by cmplieger

to add ellipsis to a sentence that is too long you can use this method: http://jsfiddle.net/ArKeu/

要将省略号添加到太长的句子中,您可以使用此方法:http: //jsfiddle.net/ArKeu/

that works great for widths but is it somehow possible to add ellipsis vertically too? that doesn't seem to work :(

这对宽度很有用,但是否也可以垂直添加省略号?这似乎不起作用:(

http://jsfiddle.net/ArKeu/2/

http://jsfiddle.net/ArKeu/2/

does anyone know this, Thanks.

有谁知道这个,谢谢。

回答by kizu

Currently there is no cross-browser CSS-only way to achieve such behavior.

目前没有跨浏览器的 CSS-only 方法来实现这种行为。

You can do this now only in webkit-based browsers by using the -webkit-boxand -webkit-line-clamp, see http://jsfiddle.net/ArKeu/7/

您现在只能在基于 webkit 的浏览器中使用-webkit-boxand 执行此操作-webkit-line-clamp,请参阅http://jsfiddle.net/ArKeu/7/

回答by kumarharsh

UPDATE! UPDATE! UPDATE!

更新!更新!更新!

Since the time when I wrote that answer, Clamp.jsseems to have cooled-off and died. The project still exists on github so you can check it out.

自从我写下那个答案以来,Clamp.js似乎已经冷却并消亡了。该项目仍然存在于github上,因此您可以查看它。

But, there is a better alternative here: ftellipsis. It is cross-browser.

但是,这里有一个更好的选择:ftellipsis。它是跨浏览器的。



Why should webkit browsers have all the fun?

为什么 webkit 浏览器应该拥有所有的乐趣?

This solution here is much more extensive, and provides support for other browsers as well. http://reusablebits.com/post/2642059628/introducing-clamp-js(dead link)

这里的解决方案要广泛得多,并且还提供对其他浏览器的支持。 http://reusablebits.com/post/2642059628/introducing-clamp-js(死链接)