title: Getting the width of an element as a floating point in jQuery
body: <p>I've been looking all over for a way to get the width of an element where it isn't rounded. The reason for wanting this is that I have several  elements floated left with display inline-block and I am trying to autosize the text within them so that they use up the entire width of the container div. I am doing it like this:</p>
  
  <ol>
  <li>Pick a small text size such as 1</li>
  <li>Make all of the text that size</li>
  <li>Add up the width of all of the floated elements</li>
  <li>If it is smaller than the width of the container, increment the font size by a small value</li>
  <li>Repeat 2-4 until you reach the maximum size</li>
  </ol>
  
  <p>The problem is that there is always space left over that isn't being used. I believe this is because when I increment the font size by small amounts (ie. 0.01) to get an accurate size. The widths of the elements don't change because it is rounding down. I can keep incrementing and they wont change until it decides to round up and then to total width is over the limit. Here is a JSFiddle showing what I'm talking about:</p>
  
  <p><a href="http://jsfiddle.net/Pkws3/" rel="nofollow">http://jsfiddle.net/Pkws3/</a></p>
  
  <p>The javascript might be a bit confusing but basically to save time it starts with large increments of the fontsize and then as it reaches the target size it'll make the increments smaller to be more accurate.</p>
  
  <p>I've tried using:</p>
  
  <pre><code>$(this).width()
  parseFloat($(this).css("width"))
  window.getComputedStyle
  </code></pre>
  
  <p>But none of them seem to work.</p>