How to calculate element's width and height with their padding / margin values using less code?

后端 未结 1 1141
梦毁少年i
梦毁少年i 2021-01-03 01:43

I am using height() / width() method but its returning value without it\'s padding and margin values. I am not having problem to calculate total with / height values.

<
相关标签:
1条回答
  • 2021-01-03 02:17

    Use outerWidth(); and outerHeight();

    var ele = $('div');
    
    var eleW = ele.outerWidth(true);
    var eleH = ele.outerHeight(true);
    
    0 讨论(0)
提交回复
热议问题