title: jquery .height() and .width() on span tag gets inconsistent results
body: <p>I need to get the dimensions of a variable-height-and-width element, <code>#sentence</code>, in order to change the dimensions of other elements that are related to it. <code>#sentence</code> is centered in the browser window, and its height and width are determined whatever its contents are. My code looks like this:</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;body&gt;
      &lt;div id="wrapper"&gt;
          &lt;div id="cell"&gt;
              &lt;span id="sentence"&gt;
                  sentence
              &lt;/span&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>CSS</p>
  
  <pre><code>body, html  {
      font-size: 18pt;
      padding: 0px;
      margin: 0px;
      overflow: hidden;
  }
  #wrapper    {
      width: 100%;
      height: 100%;
      display: table;
      text-align: center;
  }
  #cell   {
      display: table-cell; vertical-align: middle;
  }
  
  #sentence   {
      display: inline-block;
      background-color: #abc;
      padding: 1em;
  }
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>$(document).ready(function(){
      var h = $("#sentence").height();
      alert(h);
  });
  </code></pre>
  
  <p>When I try to get the <code>.height()</code> or <code>.width()</code> of <code>#sentence</code>, I get back inconsistent values. Usually for the height it's 28, but sometimes it comes back as 19. For the width, I get 84 or sometimes 52.</p>
  
  <p>I thought that perhaps the difference was caused by scrollbars temporarily appearing and then disappearing when the page loads. I tried adding <code>overflow: hidden;</code> to <code>html</code> and <code>body</code> to get rid of any scrollbars that might be showing up, but that didn't work. I also tried adding</p>
  
  <pre><code>$(window).resize(function(){ 
      h = $("sentence").width(); 
  });
  </code></pre>
  
  <p>That didn't work. Using <code>.css("height")</code> doesn't seem to work either.</p>
  
  <p>So what will? Why am I having this problem? Thanks in advance for any help with this.</p>