I'm attempting to truncate a paragraph of text and adding an ellipsis after to indicate there is more content.
I attempted to use the CSS property text-overflow:ellipsis
- however looking at examples of this it seems it is only possible with the use of no-wrap
and thus it can only be used on single lines of text, so not appropriate for truncating a paragraph.
I then came up with another soltuion, which is almost correct but has just one problem...
So instead of truncating using the ellipsis
property, I truncated the old fashioned way by using overflow:hidden
and setting a max-height
.tourItem .tourInfo
{
max-height: 110px;
overflow: hidden;
display: block;
}
And then to create the neat ellipsis I used :after
.tourItem .tourInfo:after {content:'...';}
This seems like the right way however I have run into two problems...
- The
overflow:hidden
means that the:after
content doesn't show. But it's required as it is what controls the truncated text! - The ellipsis (if you take off the
overflow:hidden
) is shown underneath the section of text. I need it to seem like it is part of the line of text...