Multi line truncate #1826
-
What are the way in tailwind to truncate with multiple lines of text? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
If you want to truncate just one line: https://tailwindcss.com/docs/word-break/#truncate For multi line, there's a plugin for it https://github.com/jhta/tailwindcss-truncate-multiline But it depends on Apart from that, there are hacks: .truncate-2-lines {
max-height: 3.6em; /* double the size of line-height */
line-height: 1.8em;
display: block;
text-overflow: ellipsis;
word-wrap: break-word;
overflow: hidden;
} The only way to do using Tailwind, that I know, would be extending with plugins: adding more max-height and leading utilities, etc... |
Beta Was this translation helpful? Give feedback.
-
nice to see this natively |
Beta Was this translation helpful? Give feedback.
-
thank you very much, its very helped me @estevanmaito |
Beta Was this translation helpful? Give feedback.
-
Thank you @estevanmaito 👏 |
Beta Was this translation helpful? Give feedback.
-
currently there is a official tailwind plugin for this |
Beta Was this translation helpful? Give feedback.
If you want to truncate just one line: https://tailwindcss.com/docs/word-break/#truncate
For multi line, there's a plugin for it https://github.com/jhta/tailwindcss-truncate-multiline
But it depends on
line-clamp
, which is an unofficial API https://caniuse.com/#feat=css-line-clampApart from that, there are hacks:
The only way to do using Tailwind, that I know, would be extending with plugins: adding more max-height and leading utilities, etc...