title: Dynamically resize container to fit text
body: <p>There are many jQuery plugins that let you resize a text to fit a container. But how can you dynamically change the width/height of a div container to fit the text inside of it?</p>
  
  <p>Below an example. As you can see the text is currently overflowing the div. How can you programatically resize the container div to fit the text independent of the font size and content?</p>
  
  <pre><code>   &lt;!DOCTYPE html&gt;
     &lt;html&gt;
     &lt;body&gt;
     &lt;div id="container" style="width:100px; height:100px;border:1px solid red; overflow: hidden;"&gt;
     &lt;p style="font-size:40px;"&gt;This is the text&lt;/p&gt;
     &lt;/div&gt;
     &lt;/body&gt;
     &lt;/html&gt;
  </code></pre>