一個非常簡單的問題。用jQuery獲取html元素的渲染高度
例如,我有這樣一個類:
.someclass {
font-size: 1.2em /* let's say that 1em is set to 10px in this example */
padding: 1em 0 2em 0;
border: 0.1em solid #000;
}
和一些簡單的HTML中使用它:
<div class="someclass">Test</div>
我想獲得該元素的產生高度 - 計算的高度帶邊框和填充。在此示例中使用jQuery .height()
方法給出當前值line-height
屬性 - 如預期的那樣,因爲div中的文本只有一行。
我知道我可以自己做計算,因爲它們相對比較簡單,但我想問一下在jQuery中是否有內置解決方案?
我接受你的因爲整體價值;) – Przemek