How to get computed style of a HTMLElement

后端 未结 2 442
长发绾君心
长发绾君心 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:43

    Take a look at:

    • Get the rendered style of an element
    0 讨论(0)
  • 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.

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