4

I was trying to make a link restricted to a width using the ellipsis.

The html is something like this:

<a class="blueLink2 destination-url-space" style="top:0;" href="http://google.com/uyv245">http://google.com/iuh345345345gthrthrthrth</a>

and the CSS is

.blueLink2 {
    color: #0051A1;
    display: inline;
    font-size: 14px;
    margin-left: 5px;
    overflow: hidden;
    position: relative;
    text-overflow: ellipsis;
    top: 0;
}
.destination-url-space {
    display: inline-block;
    max-width: 200px;
    overflow-x: hidden;
}

But it's working only in Chrome. Not working in Firefox. Demo: http://jsfiddle.net/xE6HG/

radbyx
  • 9,352
  • 21
  • 84
  • 127
user1012181
  • 8,648
  • 10
  • 64
  • 106

2 Answers2

7

you need to add white-space: nowrap; there

DEMO

Sowmya
  • 26,684
  • 21
  • 96
  • 136
2

p{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  -o-text-overflow: ellipsis;
  -ms-text-overflow: ellipsis;
  -moz-binding: url('ellipsis.xml#ellipsis');
}
<p>
Lorem ipsum is a pseudo-Latin text used in web design, typography, layout, and printing in place of English to emphasise design elements over content. It's also called placeholder (or filler) text. It's a convenient tool for mock-ups. It helps to outline the visual elements of a document or presentation, eg typography, font, or layout. 
</p>

<p>
Lorem ipsum is a pseudo-Latin text used in web design, typography, layout, and printing in place of English to emphasise design elements over content. It's also called placeholder (or filler) text. It's a convenient tool for mock-ups. It helps to outline the visual elements of a document or presentation, eg typography, font, or layout. 
</p>
Nikit Barochiya
  • 971
  • 11
  • 14