I have a <div>
that has a limited size, and I am looking for a way to display multiline text in it. If the text exceeds the available space, I would like to add "..." at the end along with a link to view the full content on another page.
Is there a way to achieve this using Javascript/CSS? I tried researching but couldn't find a clear solution.
It seems like there is a CSS property text-overflow: ellipsis;
, but adding a link on the ellipsis might not be possible.
The answer provided here is close, but there are instances where only a part of the ellipsis appears if the text starts to overflow.
Library requirements: I am open to using jQuery (albeit reluctantly), but I would prefer a cross-browser solution that doesn't rely on any specific framework.