How to get computed style of a HTMLElement

后端 未结 2 451
长发绾君心
长发绾君心 2020-12-04 02:16

no jQuery. pure javascript.

e.g. Use element.height but I got nothing.

I ever seen code like below befow:

(ele.style || ele)[styleName]
         


        
2条回答
  •  盖世英雄少女心
    2020-12-04 02:48

    There are some pointers in http://www.quirksmode.org/dom/getstyles.html

    also, google clientHeight offsetHeight and you will find info on height.

提交回复
热议问题