1

I have some divs with ul > li lists in them. Each item should be one line tall and should not wrap. Ideally, ellipses ... should be inserted for lines that would otherwise wrap: these li items should be prevented from wrapping.

Is it possible to accomplish this with through a combination of css and jQuery?

dan
  • 43,914
  • 47
  • 153
  • 254
  • [This question](http://stackoverflow.com/questions/536814/javascript-insert-ellipsis-into-html-tag-if-content-too-wide) may help. – Stephen P Jan 21 '11 at 01:50

3 Answers3

2

Add text-overflow: ellipsis.

Unfortunately, it's not supported by Firefox.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
1

Check out this solution using jQuery to decrement the length of the string until it fits inside the desired dimension. http://jsfiddle.net/3jwLU/

Aaron Hathaway
  • 4,280
  • 2
  • 19
  • 17
0

You can use CSS3 text-overflow property.

If that's not an option you have a lot of jQuery plugins that do what you want. Just search for ellipses in jQuery plugins page...

nunopolonia
  • 14,157
  • 3
  • 26
  • 29