0

I have this element that contains a string which exceeds the space available. Text should be displayed on two lines only. I need text-overflow: ellipsis to be triggered but it's not happening here. What am I doing wrong?

<div><span>IpsumLorem Traborditum orb Porfalohyrm</span></div>
div{
    text-overflow: ellipsis;
    overflow: hidden;
    float: left;
    line-height: 20px;
    padding: 8px 6px 6px;
    height: 44px;
    width: 133px;
}

JSFiddle

Passerby
  • 9,715
  • 2
  • 33
  • 50
greener
  • 4,989
  • 13
  • 52
  • 93

2 Answers2

-2

You need white-space: nowrap; for text-overflow: ellipsis; to work properly: http://jsfiddle.net/DHge3/3/

Lowkase
  • 5,631
  • 2
  • 30
  • 48
  • 1
    OP try to display text in Two lines, not in a single line as your Fiddle show it in a single line. – Usman Jan 30 '13 at 04:51
-2

Remove padding from your CSS and it will work fine

CSS

div {
    line-height: 20px;
    height: 44px;
    width: 133px;
    overflow: hidden;
    text-overflow: ellipsis;
}

FIDDLE

Usman
  • 3,200
  • 3
  • 28
  • 47