I have a specific requirement where I am looking to present two lines of text, followed by an icon displayed through an img tag. If the text exceeds two lines, I want to display an ellipsis. However, it is crucial that the icon remains inline with the text and is not clipped if the length of the text increases.
The desired outcome should resemble:
A lengthy text that
spans two lin.. 🙂
For this example, let's consider the emoji as an img
tag
Place icon after a line with text-overflow ellipsis
When dealing with a single line of text, utilizing inline-block as recommended in the stack overflow thread above works perfectly. However, when attempting to apply this to multiline text, it doesn't have the desired effect.
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
-moz-box-orient: vertical;
https://codepen.io/praneethack/pen/LYxxPGN
Edit: I have made adjustments to the code on CodePen to include an img tag instead of a font icon