Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Update:</strong> <a href="http://hacks.mozilla.org/2011/09/whats-new-for-web-developers-in-firefox-7/" rel="noreferrer"><code>text-overflow: ellipsis</code> is now supported</a> as of Firefox 7 (released September 27th 2011). Yay! My original answer follows as a historical record.</p> <p>Justin Maxwell has cross browser CSS solution. It does come with the downside however of not allowing the text to be selected in Firefox. Check out <a href="http://mattsnider.com/css/css-string-truncation-with-ellipsis/" rel="noreferrer">his guest post on Matt Snider's blog</a> for the full details on how this works.</p> <p>Note this technique also prevents updating the content of the node in JavaScript using the <code>innerHTML</code> property in Firefox. See the end of this post for a workaround.</p> <p><strong>CSS</strong></p> <pre><code>.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -o-text-overflow: ellipsis; -moz-binding: url('assets/xml/ellipsis.xml#ellipsis'); } </code></pre> <p><strong><code>ellipsis.xml</code> file contents</strong></p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;bindings xmlns="http://www.mozilla.org/xbl" xmlns:xbl="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" &gt; &lt;binding id="ellipsis"&gt; &lt;content&gt; &lt;xul:window&gt; &lt;xul:description crop="end" xbl:inherits="value=xbl:text"&gt;&lt;children/&gt;&lt;/xul:description&gt; &lt;/xul:window&gt; &lt;/content&gt; &lt;/binding&gt; &lt;/bindings&gt; </code></pre> <p><strong>Updating node content</strong></p> <p>To update the content of a node in a way that works in Firefox use the following:</p> <pre><code>var replaceEllipsis(node, content) { node.innerHTML = content; // use your favorite framework to detect the gecko browser if (YAHOO.env.ua.gecko) { var pnode = node.parentNode, newNode = node.cloneNode(true); pnode.replaceChild(newNode, node); } }; </code></pre> <p>See <a href="http://mattsnider.com/javascript/dynamically-updating-content-of-firefox-ellipsis-hack/" rel="noreferrer">Matt Snider's post for an explanation of how this works</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload