views:

841

answers:

2

Well, encountered the need of a line-height coding a plugin, so, can you give an advice, please? Thanks)

+4  A: 
$('selector').css('line-height');
cpharmston
Oh, thank you, I cannot understand why, but I simply forget that .css() can not only to set values, but also to get...
Remember to mark the answer as correct when it is correct! =)
Christopher Done
Yes, ok, I'm new here yet)
Wrong. In opera it returns 'normal'.
Veton
A: 

$('selector').css('line-height');

Returns line height as a decimal value in pixels, with unit, e.g. "22.5px"

Care should be taken with this solution, as different browsers will report different results. I have found that you cannot use unitless measures with line-height (eg 2.2) in your CSS, as IE6 will report an incorrect result (eg 2px instead of, eg 36px). So I recommend using unit-based line-heights with this measure.

kenneth