Mahesh Kamani
Mahesh Kamani

Reputation: 78

How to get line height in percentage using jquery?

Using this I get the full line-height value in px i want in percentage.

<div style="line-height:78%" id="example">This is HTML.</div>
<script>
    $('#example').css('line-height');
    /* Return 54px; but needed is 78% */
</script>

Upvotes: 1

Views: 392

Answers (1)

jcubic
jcubic

Reputation: 66490

Try:

$('#example')[0].style['line-height'];

You will get exact line-height that is set in inline style.

Upvotes: 4

Related Questions