Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
872 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...