I'm struggling with formatting a <span>
tag, specifically the .lastMessageLink
class that contains an <a>
element with the .lastMessageText
class. The content within .lastMessageText
can vary from just a few characters to a lengthy paragraph, but I want to limit it to display only up to 4 lines of text.
The current CSS styling I've tried, unfortunately, isn't achieving the desired result:
.lastMessageLink {
line-height: 1em;
text-overflow: ellipsis;
max-height: 4em;
overflow: hidden;
}
.lastMessageText {
color: black;
word-wrap: break-word;
}
Below is an example snippet of the HTML structure in question:
<span class="lastMessageLink">
<a id="undefined" class="lastMessageText" title="now i need a really really long message so that i can test this whole multiple lines thing which is gonna be a problem and a trickier problem than we had initially thought. it's interesting because you'd think a couple css styles would be enough, but we might have to go by characters" href="#conversation:cid=10714&mid=10735">
now i need a really really long message so that i can test this whole multiple lines thing which is gonna be a problem and a trickier problem than we had initially thought. it's interesting because you'd think a couple css styles would be enough, but we might have to go by characters
</a>
</span>
I've researched solutions on limiting text lines using CSS such as those found on Stack Overflow, but I may need to explore utilizing jQuery or Javascript for a solution since pure CSS hasn't been successful thus far.