Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 div,它在其中嵌套文本、更频繁地更改的图像,因此 div 的高度也会相应地改变..
我需要得到 div 的高度。
我试过jquery $("div#ID").height();,但它总是返回一个小于实际高度的值,请问有什么帮助吗?
$("div#ID").height();
也许你应该尝试,
$("#divID").outerHeight(); $("#divID").outerHeight(true); //includes margin of element