Example 1. Starting with the textWith no width restrictions, and no ellipsis, this paragraph (
<p>tag) displays as one would expect…a big block of text. We’ve given it a some visual treatment to distinguish it as an interface element in these examples:
But that’s not what we want. We’re looking for a single line, the sizing of which we can control in our interface.
Example 2. Prevent line wrap and bring on the ellipsis!We’ll start by adding a class ".ellipsis" to the
<p>tag and building it by example. Add white-space: nowrap, to limit the paragraph to a single line, and overflow: hidden keeps it from making the browser window wider. We then add width: 300px to limit the size (IE6 needs a width defined, even if it’s 100%) and begin constructing our label. Also, first recommended for CSS3 back in 2003, the CSS Text Module includes support for text-overflow: ellipsis. So putting that all together:
And if it were as simple as that, this article wouldn’t be necessary. While the text-overflow: ellipsisproperty is supported in Internet Explorers 6 & 7, Safari 3 & 4, Chrome 1 &2, it requires special handling for IE 8 Standards Mode, Opera, and FireFox. 
Example 3. text-overflow in Opera and IE 8Opera’s developers recognize that the text-overflow property isn’t part of the official spec yet, and distinguishes it as a proprietary property through the use of the -o prefix. Microsoft introduced something similar in IE 8 with the -ms prefix. So let’s add that:
Alright, alright, no more teasing. On to the goods. Let’s deal with the 400 lb. fox in the room.
Example 4. Making it work in FireFoxWhile implementation of the text-overflow property in FireFox is in development, it has been "in development" for a long time. But FireFox does support XUL, Mozilla’s XML User Interface Language. While it may be the first time you’ve heard about it, many of the popular FireFox add-ons are written in, or rely on, XUL. XUL has a crop property for the description element, which specifies "An ellipsis will be used in place of the cropped text" .
And this is where Rikkert Koppes, a developer in The Netherlands, figured out how to put it all together. Firefox’s support for XBL (XML Binding Language) allows us to "associate elements in a document with script, event handlers, CSS, and more complex content models, which can be stored in another document". So in this case, the other document is going to be our XUL description element with tail truncation (crop), which by default in XUL will have ellipsis, and the association will be through FireFox’s support of XBL bindings in CSS. First, we’ll create the XUL, which should be saved as ellipsis.xml:
At Mint.com, we store this alongside our CSS directory in a folder named xml. You may wish to do the same. Then we tell our FireFox-only (-moz prefix) CSS to bind the .ellipsis class to the XUL:Description element’s described behavior, referenced by a unique ID (that binding id="ellipsis") in the XML code above:
Success! If you don’t see it working on your site, double-check your path to the XML document in the CSS declaration.