使用这个我得到包括px的全线高度值。
$('#example').css('line-height');
parseInt($(‘#example’)。css(‘line-height’),10);
输出:
18
作为一个整数。其他解决方案维护String类型。
编辑
对于可能包含小数点的值,可以使用parseFloat()
parseFloat($( ‘#例子’)的CSS( ‘线高度’)。);
18.4