我知道这样可以限制到几行,有没有可以限定文字个数的?
.content{line-height:20px;display: -webkit-box;
-webkit-line-clamp:3;
-webkit-box-orient: vertical;
overflow: hidden;}
PHPz2017-04-17 11:39:06
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.
PHP中文网2017-04-17 11:39:06
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.
怪我咯2017-04-17 11:39:06
You can’t directly limit the number of words. Clamp limits it to rows. The number of words is still controlled by js