Reputation: 21
Using Javascript, how to get table row height in actual pixels? In the example, I would like to get measurement from top of green border to the top of the next green border.
Using jQuery .height(), outerHeight(), .offsetHeight and .clientHeight does not return correct answer (it's 44px). (see http://jsfiddle.net/kaG7g/8/ )
HTML
<table>
<tr><td>this a table</td></tr>
<tr><td>this is a contents</td></tr>
<tr id="tableElement"><td>of element</td></tr>
</table>
CSS
td {
height:20px;
border-top:10px solid green;
border-bottom:10px solid yellow;
}
Upvotes: 2
Views: 3759
Reputation: 6525
Try this,
console.log( $('td').css('border-top').split('p')[0] );
console.log( $('td').css('border-bottom').split('p')[0] );
console.log( $('td').height() );
Upvotes: 2