asfsdagsagfsagfsdgh
gsagsdfadgsdhfdgsd
afgsdghdfhsdgsdgasd
Let's say there are three lines
asfsdagsagfsagfsdgh
gsagsdfadgsdhfdgsd
afgsdghdfh
They want to cut it to this length. I don't know what to do.
If you simply cut it by the number of characters, it contains special symbols, capital letters, and spacesI saw that even if you want to cut it in the third line, it goes to the fourth line or it gets cut in the second line. What should I do if I don't want to go beyond the third line?
jquery javascript
Stack overflow is the checkpoint.
https://stackoverflow.com/questions/33058004/applying-an-ellipsis-to-multiline-text
The articles below are also worth seeing.
https://css-tricks.com/line-clampin/
Personally, I think it's more robust to use a library controlled by Js than CSS.
Originally, there is a famous library called dotdotdot, but it seems that you have to pay for commercial use. http://dotdotdot.frebsite.nl/
Clamp.js looks good if it's free. https://github.com/josephschmitt/Clamp.js
© 2024 OneMinuteCode. All rights reserved.