Question

Here is where the 3 boxes are. All of them share the same amount of characters. Inside the boxes I need the text to be limited so that If the user insert more text, the last word is followed by ... preventing the content to override the box.

I've already tried with text-overflow: ellipsis;

But I believe I'm using it wrong. As If I add more text to each box, the text overrides the box.

No correct solution

OTHER TIPS

text-overflow: ellipsis only works with the following combination: fixed width, overflow hidden and white-space: nowrap; the elipssis does not work with mulitple lines.

You should use something like this: http://www.mobify.com/blog/multiline-ellipsis-in-pure-css/

Single line example: Fiddle

.ellipsis {
    text-overflow: ellipsis;
    width: 150px;
    overflow: hidden;
    white-space: nowrap;
}

text-overflow will only have an effect if the white-space: nowrap is set which means you cannot use it to truncate text which is more than one line.

This means you're stuck with truncating the text on the server or using javascript. There are a few good jQuery plugins out there for this, something like dot dot dot should do the trick.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top