Skip to content

Instantly share code, notes, and snippets.

@Voronenko
Created December 13, 2013 16:26
Show Gist options
  • Save Voronenko/7946863 to your computer and use it in GitHub Desktop.
Save Voronenko/7946863 to your computer and use it in GitHub Desktop.
Reliable way to get line-height of the particular html element with JQuery
function dirty_lineheight_px(obj) {
$(obj).append("<div id='dirty_lineheight_px' style='position:absolute; visibility:hidden'>S</div>");
// measure
var temp_height = $('#dirty_lineheight_px').height();
// cut
$('#dirty_lineheight_px').remove();
return temp_height;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment