jquery: wrong values when trying to get div height

后端 未结 1 1457
轻奢々
轻奢々 2020-12-11 16:25

i\'m having this html structure:

Content goes here
相关标签:
1条回答
  • 2020-12-11 16:53

    Use $("div.content").outerHeight(); instead.

    If you add -true- in the parenthesis if you want to include all margins & paddings as well. $('div.content').outerHeight(true);

    Also cross-browser heights may differ if you don't have very good CSS Resets, or are looking at a legacy browser (ie6/7), but with a good reset their differences will be very miniscule.

    jsFiddle Demo

    0 讨论(0)
提交回复
热议问题