Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Unfortunately what you want to achieve, to animate to <code>width: auto;</code>, can't be done using CSS only. You can test it <a href="http://jsfiddle.net/tAPsj/" rel="nofollow">here</a>. This is due to this issue, that isn't only related to Firefox: <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=571344" rel="nofollow">Bug 571344 - Support transitions to and from 'auto' values of left, top, width, height, etc.</a>.</p> <p>You can build a little JavaScript workaround, that will help you out here:</p> <p><strong>HTML</strong></p> <pre><code>&lt;ul&gt; &lt;li&gt;Content 1 with more text&lt;/li&gt; &lt;li&gt;Content 2&lt;/li&gt; &lt;/ul&gt; </code></pre> <p><strong>CSS</strong></p> <pre><code>ul &gt; li { float: left; width: 50px; overflow: hidden; border: 1px solid rgba(0, 0, 0, 0.3); white-space: nowrap; text-overflow: ellipsis; -webkit-transition: width 0.55s ease-in-out; -moz-transition: width 0.55s ease-in-out; -ms-transition: width 0.55s ease-in-out; -o-transition: width 0.55s ease-in-out; transition: width 0.55s ease-in-out; } </code></pre> <p><strong>JavaScript</strong></p> <p>In this example I use the <a href="http://jquery.com" rel="nofollow">jQuery</a> library. But it can also be done with <a href="http://vanilla-js.com" rel="nofollow">Vanilla JS</a> very easily.</p> <pre><code>var elements = $('ul li'); elements.each(function(key, value) { var e = $(this) e.data('width-real', e[0].scrollWidth); e.data('width-collapsed', e.width()); }); elements.hover( function() { var e = $(this) e.css('width', e.data('width-real')); }, function() { var e = $(this) e.css('width', e.data('width-collapsed')); } ); </code></pre> <p><strong>Demo</strong></p> <p><a href="http://jsfiddle.net/TJ94M/" rel="nofollow">Try before buy</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. This table or related slice is empty.
    1. This table or related slice is empty.
    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