detecting true border, padding and margin from Javascript

前端 未结 3 882
执笔经年
执笔经年 2021-02-04 13:44

Is there a way to detect the true border, padding and margin of elements from Javascript code? If you look at the following code:


    
          


        
3条回答
  •  别那么骄傲
    2021-02-04 14:09

    It's possible, but of course, every browser has its own implementation. Luckily, PPK has done all the hard work for us:

    http://www.quirksmode.org/dom/getstyles.html

提交回复
热议问题