不带“-webkit-line-clamp” [英] Clamping lines without '-webkit-line-clamp'

查看:756
本文介绍了不带“-webkit-line-clamp”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的很多时候,webkit中存在一个用于使用纯CSS压缩行的技巧:

  display:-webkit -框; 
-webkit-line-clamp:3;
-webkit-box-orient:vertical;虽然这种语法与显示很好地共存:-webkit-flex code>语法,在所有基于webkit的现代浏览器中,它被认为已过时。



我的问题是:

如何在纯CSS中实现线钳位,而不使用过时的' - webkit-line-clamp'技巧?

解决方案

唯一的跨浏览器解决方案是使用js afaik。此处讨论了使用省略号进行多行截断问题的几种解决方案: http://css-tricks.com/line-clampin /



我讨厌他们,但欢迎来到网站开发。


In the good old days, there existed a trick in webkit for clamping lines using pure css:

display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;

Though this syntax happily coexists with the display: -webkit-flex syntax, in all modern webkit-based browsers, it is considered obsolete.

My question is:

How can I achieve line clamping in pure CSS and without the obsolete '-webkit-line-clamp' trick?

解决方案

The only cross-browser solution is to use js afaik. Several solutions to the problem of multi-line truncation with ellipsis are discussed here: http://css-tricks.com/line-clampin/

I hate them all, but welcome to web development.

这篇关于不带“-webkit-line-clamp”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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