title: Animate an element's width from 0 to 100%, with it and it's wrapper being only as wide as they need to be, without a pre-set width, in CSS3 or jQuery
body: <p><a href="http://jsfiddle.net/nicktheandroid/tVHYg/" rel="noreferrer">http://jsfiddle.net/nicktheandroid/tVHYg/</a></p>
  
  <p>When hovering <code>.wrapper</code>, it's child element <code>.contents</code> should animate from <code>0px</code> to it's natural width. Then when the mouse is removed from <code>.wrapper</code>, it should animate back down to <code>0px</code>. The <code>.wrapper</code> element should only be as wide as it needs to be (allowing <code>.contents</code> to grow), so <code>.wrapper</code> should grow in width and shrink in width as <code>.contents</code> does. There should be no set width for <code>.contents</code>. I'm using CSS3, but it could be accomplished in jQuery, that would be fine.</p>
  
  <p><strong>The problem:</strong>
  See the JSfiddle </p>
  
  <ol>
  <li><code>.wrapper</code> is not only as wide as it needs to be.</li>
  <li>when <code>.contents</code> grows, when it's almost at it's full width, it jumps down to the next line</li>
  <li>When hovering off of <code>.wrapper</code>, <code>.contents</code> vanishes, when it should animate down to <code>0px</code></li>
  </ol>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.wrapper {
      display: inline-block;
  
      height: 20px;
      width: auto;
    
      padding:10px;
    
      background:#DDD;
  }
  
  .contents {
      display:inline-block;
    
      width:0%;
    
      white-space:nowrap;
      overflow:hidden;
    
      background:#c3c;
  }
  
  .wrapper:hover .contents {
      -webkit-transition: width 1s ease-in-out;
      -moz-transition: width 1s ease-in-out;
      -o-transition: width 1s ease-in-out;
      transition: width 1s ease-in-out;
  
      width:100%;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="wrapper"&gt;
      &lt;span&gt;+&lt;/span&gt;
      &lt;div class="contents"&gt;These are the contents of this div&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>