title: jQuery returning different heights for the same objects in WebKit (chrome) and Firefox
body: <p>Im perplexed by this one.</p>
  
  <p>jQuery.height() is coming back with different values in Firefox and Chrome. Measuring the pixels on-screen indicates that of the two, Chrome appears to be reporting the correct value, while firefox is off by 2 or 3 pixels each time. Has anyone else encountered this issue?</p>
  
  <p>I've tried grabbing the height using the various jQuery height functions (innerHeight, outerHeight, height) to no avail. I have stripped all css styling that may have potentially been interfering with the height value (all padding, borders, margin, etc) yet I still get inconsistent results.</p>
  
  <p>If it helps, I am dealing with table cells. The code creates a second table alongside the first, and then matches the height of each row to create a sort of "sticky" left hand column on the table. The cells have varying content but matching 0 values for border, padding and margin on all sides.</p>
  
  <p><strong>EDIT</strong>
  6 hours later, this problem continues to stump me.</p>
  
  <p>When I nix the borders and switch to using innerHeight() to get the height measurement, both browsers render it perfectly. But I need to get a bottom-border in there...</p>
  
  <p>At the moment I have webkit rendering the table with the borders perfectly, and firefox is off by 1px on each cell. I switched to using jQuery's innerHeight() function to grab the heights of the cells on the 'master' table, but somehow firefox always comes up a pixel short on the measurement.</p>
  
  <p>Here is the relevant code involved. Note that the HTML is copied from firebug AFTER being generated by the javascript, so the height declarations are being made there. 'master' table HTML:</p>
  
  <pre><code>&lt;table cellpadding="0" border="0" class="items-table"&gt;
  &lt;tbody&gt;
      &lt;tr class="selected"&gt;
          &lt;td itemid="70609" class="id" style="display: none;"&gt;
              70609
          &lt;/td&gt;
          &lt;td class="thumb"&gt;
              &lt;div class="item-thumb"&gt;
                  &lt;div style="background-image: url(&amp;quot;http://c1263382.cdn.cloudfiles.rackspacecloud.com/2C5D13C6-8A9F-47D9-81B51305D3FF24A9_t.jpg&amp;quot;);" class="item-thumb-image"&gt;
                      &lt;img src="http://c1263382.cdn.cloudfiles.rackspacecloud.com/2C5D13C6-8A9F-47D9-81B51305D3FF24A9_t.jpg"&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/td&gt;
          &lt;td class="details"&gt;
              &lt;div class="name"&gt;
                  &lt;span class="code"&gt;R1000&lt;/span&gt; &lt;span class="description"&gt;Armoire&lt;/span&gt;
              &lt;/div&gt;
              &lt;div class="itemtype"&gt;
                  &lt;span&gt;Casegoods&lt;/span&gt; &lt;input type="hidden" value="13" name="70609-itemtypeid" id="70609-itemtypeid" class="itemtypeid"&gt;
              &lt;/div&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="selected"&gt;
          &lt;td itemid="70634" class="id" style="display: none;"&gt;
              70634
          &lt;/td&gt;
          &lt;td class="thumb"&gt;
              &lt;div class="item-thumb"&gt;
                  &lt;div style="background-image: url(&amp;quot;http://c1263382.cdn.cloudfiles.rackspacecloud.com/29DA825A-0431-49ED-A2614B3544EB50D2_t.jpg&amp;quot;);" class="item-thumb-image"&gt;
                      &lt;img src="http://c1263382.cdn.cloudfiles.rackspacecloud.com/29DA825A-0431-49ED-A2614B3544EB50D2_t.jpg"&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/td&gt;
          &lt;td class="details"&gt;
              &lt;div class="name"&gt;
                  &lt;span class="code"&gt;C1124&lt;/span&gt; &lt;span class="description"&gt;Nightstand&lt;/span&gt;
              &lt;/div&gt;
              &lt;div class="itemtype"&gt;
                  &lt;span&gt;Casegoods&lt;/span&gt; &lt;input type="hidden" value="13" name="70634-itemtypeid" id="70634-itemtypeid" class="itemtypeid"&gt;
              &lt;/div&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="selected"&gt;
          &lt;td itemid="70642" class="id" style="display: none;"&gt;
              70642
          &lt;/td&gt;
          &lt;td class="thumb"&gt;
              &lt;div class="item-thumb"&gt;
                  &lt;div style="background-image: url(&amp;quot;http://c1263382.cdn.cloudfiles.rackspacecloud.com/46AAB8C6-7BAD-4740-8B26A05521025029_t.jpg&amp;quot;);" class="item-thumb-image"&gt;
                      &lt;img src="http://c1263382.cdn.cloudfiles.rackspacecloud.com/46AAB8C6-7BAD-4740-8B26A05521025029_t.jpg"&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/td&gt;
          &lt;td class="details"&gt;
              &lt;div class="name"&gt;
                  &lt;span class="code"&gt;999&lt;/span&gt; &lt;span class="description"&gt;Nice Table New Name&lt;/span&gt;
              &lt;/div&gt;
              &lt;div class="itemtype"&gt;
                  &lt;span&gt;Casegoods&lt;/span&gt; &lt;input type="hidden" value="13" name="70642-itemtypeid" id="70642-itemtypeid" class="itemtypeid"&gt;
              &lt;/div&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="selected"&gt;
          &lt;td itemid="70643" class="id" style="display: none;"&gt;
              70643
          &lt;/td&gt;
          &lt;td class="thumb"&gt;
              &lt;div class="item-thumb"&gt;
                  &lt;div style="background-image: url(&amp;quot;http://c1263382.cdn.cloudfiles.rackspacecloud.com/71F27D5A-8BA6-428B-BAD842D699B6591A_t.jpg&amp;quot;);" class="item-thumb-image"&gt;
                      &lt;img src="http://c1263382.cdn.cloudfiles.rackspacecloud.com/71F27D5A-8BA6-428B-BAD842D699B6591A_t.jpg"&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/td&gt;
          &lt;td class="details"&gt;
              &lt;div class="name"&gt;
                  &lt;span class="code"&gt;OC603&lt;/span&gt; &lt;span class="description"&gt;Coffee Table&lt;/span&gt;
              &lt;/div&gt;
              &lt;div class="itemtype"&gt;
                  &lt;span&gt;Casegoods&lt;/span&gt; &lt;input type="hidden" value="13" name="70643-itemtypeid" id="70643-itemtypeid" class="itemtypeid"&gt;
              &lt;/div&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class=""&gt;
          &lt;td itemid="70644" class="id" style="display: none;"&gt;
              70644
          &lt;/td&gt;
          &lt;td class="thumb"&gt;
              &lt;div class="item-thumb"&gt;
                  &lt;div style="background-image: url(&amp;quot;http://c1263382.cdn.cloudfiles.rackspacecloud.com/BB263083-013F-4188-BF26CA77CF66C1E5_t.jpg&amp;quot;);" class="item-thumb-image"&gt;
                      &lt;img src="http://c1263382.cdn.cloudfiles.rackspacecloud.com/BB263083-013F-4188-BF26CA77CF66C1E5_t.jpg"&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/td&gt;
          &lt;td class="details"&gt;
              &lt;div class="name"&gt;
                  &lt;span class="code"&gt;OC606&lt;/span&gt; &lt;span class="description"&gt;Coffee Table&lt;/span&gt;
              &lt;/div&gt;
              &lt;div class="itemtype"&gt;
                  &lt;span&gt;Casegoods&lt;/span&gt; &lt;input type="hidden" value="13" name="70644-itemtypeid" id="70644-itemtypeid" class="itemtypeid"&gt;
              &lt;/div&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
  </code></pre>
  
  <p></p>
  
  <p>secondary table HTML:</p>
  
  <pre><code>&lt;table cellpadding="0" border="0" class="items-table"&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td itemid="70609" class="id" style="height: 45px;"&gt;&lt;/td&gt;
              &lt;td data-contactid="34759" class="bid pending" style="height: 45px;"&gt;
                  &lt;div class="bid-container"&gt;
                      &amp;nbsp;
                      &lt;div&gt;
                          Sent 2 days ago
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/td&gt;
              &lt;td data-contactid="34746" class="bid" style="height: 45px;"&gt;
                  &lt;div class="bid-container"&gt;
                      &amp;nbsp;
                  &lt;/div&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td itemid="70634" class="id" style="height: 53px;"&gt;&lt;/td&gt;
              &lt;td data-contactid="34759" class="bid" style="height: 53px;"&gt;
                  &lt;div class="bid-container"&gt;
                      &amp;nbsp;
                  &lt;/div&gt;
              &lt;/td&gt;
              &lt;td data-contactid="34746" class="bid bid-data assigned" style="height: 53px;"&gt;
                  &lt;div class="bid-container"&gt;
                      &amp;nbsp;
                      &lt;div class="cost"&gt;
                          $90.00
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td itemid="70642" class="id" style="height: 53px;"&gt;&lt;/td&gt;
              &lt;td data-contactid="34759" class="bid pending" style="height: 53px;"&gt;
                  &lt;div class="bid-container"&gt;
                      &amp;nbsp;
                      &lt;div&gt;
                          Sent 2 days ago
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/td&gt;
              &lt;td data-contactid="34746" class="bid" style="height: 53px;"&gt;
                  &lt;div class="bid-container"&gt;
                      &amp;nbsp;
                  &lt;/div&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td itemid="70643" class="id" style="height: 45px;"&gt;&lt;/td&gt;
              &lt;td data-contactid="34759" class="bid pending" style="height: 45px;"&gt;
                  &lt;div class="bid-container"&gt;
                      &amp;nbsp;
                      &lt;div&gt;
                          Sent 2 days ago
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/td&gt;
              &lt;td data-contactid="34746" class="bid" style="height: 45px;"&gt;
                  &lt;div class="bid-container"&gt;
                      &amp;nbsp;
                  &lt;/div&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td itemid="70644" class="id" style="height: 45px;"&gt;&lt;/td&gt;
              &lt;td data-contactid="34759" class="bid" style="height: 45px;"&gt;
                  &lt;div class="bid-container"&gt;
                      &amp;nbsp;
                  &lt;/div&gt;
              &lt;/td&gt;
              &lt;td data-contactid="34746" class="bid" style="height: 45px;"&gt;
                  &lt;div class="bid-container"&gt;
                      &amp;nbsp;
                  &lt;/div&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>CSS:</p>
  
  <pre><code>.items-table {
      font-size: 12px;
      color: #252629;
      position: relative;
  }
  .items-table td {
      height: 46px;
      padding: 4px;
      border-bottom: 1px solid #E0E3E3;
      vertical-align: top;
  }
  .items-table .item-thumb { margin-right: 0px; }
  
  .items-table tr { cursor: pointer; }
  
  .items-table td.id { display:none; }
  .items-table td.checkbox { width: 16px; padding: 0 6px 0 9px; vertical-align: middle; }
  .items-table td.thumb { width: 48px; vertical-align: middle; }
  
  .items-table td.details { vertical-align: middle; }
  .items-table td.details .code { font-weight: bold; }
  .items-table td.details .itemtype { color: #606060; }
  
  .items-table tr.selected td {
      background: #E3E3E3;
  }
  .items-table tr:hover td { background: #ccdbe5; }
  .items-table tr.active td { background: #1f6497 url('/images/selected-item.png') repeat-x  top left; color: white; font-weight: bold; }
  .items-table tr.active .itemtype { color: #C1C5E1; }
  
  .items-table .cost { padding: 2px 0 0 0; }
  .items-table .tags { padding: 2px 0 0 0; }
  </code></pre>
  
  <p>jQuery business:</p>
  
  <pre><code>$('#items .items-table tr').each(function() {
                          var ti = $(this).find('.id').text();
                          $('#bids .items-table').append("&lt;tr&gt;&lt;td class='id' itemid='"+ti+"'&gt;&lt;/td&gt;"+newCells+"&lt;/tr&gt;")
                          var th = $(this).find('td.thumb').innerHeight();
                          $('#bids .items-table').find('tr:last td').height(th);
                      });
  </code></pre>
  
  <p>And this is what it looks like in Chrome:
  <a href="http://dl.dropbox.com/u/5536259/chromeSpacing.png">alt text http://dl.dropbox.com/u/5536259/chromeSpacing.png</a></p>
  
  <p>Firefox:
  <a href="http://dl.dropbox.com/u/5536259/firefoxSpacing.png">alt text http://dl.dropbox.com/u/5536259/firefoxSpacing.png</a></p>