css3怎么限定文字字数
PHPz
PHPz 2017-04-17 11:37:06
0
4
465

我知道这样可以限制到几行,有没有可以限定文字个数的?

.content{line-height:20px;display: -webkit-box;
    -webkit-line-clamp:3;
    -webkit-box-orient: vertical;
    overflow: hidden;}
PHPz
PHPz

学习是最好的投资!

reply all(4)
PHPzhong

I don’t think I’ve seen it before. CSS is at the presentation layer. If you need to limit the number of words, it’s better to use JS to process it. Of course this is just my understanding.

巴扎黑

It’s better to use js

Ty80

The lines of your code are to display ... after the multi-line text exceeds the limited width and height;
As for limiting the number of words, using CSS can only control the width and height of the container, but it cannot be precise to how many words. character.
Use JS to handle it.

刘奇

You can’t directly limit the number of words. Clamp limits it to rows. The number of words is still controlled by js

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template