1
使用此我得到我想要的百分比px中的完整行高值。如何使用jquery獲取百分比線高?
<div style="line-height:78%" id="example">This is HTML.</div>
<script>
$('#example').css('line-height');
/* Return 54px; but needed is 78% */
</script>
使用此我得到我想要的百分比px中的完整行高值。如何使用jquery獲取百分比線高?
<div style="line-height:78%" id="example">This is HTML.</div>
<script>
$('#example').css('line-height');
/* Return 54px; but needed is 78% */
</script>
嘗試:
$('#example')[0].style['line-height'];
你會得到在內嵌樣式設定確切的行高度。
感謝@ jcubic它爲我工作 –