Get a CSS value with JavaScript

前端 未结 9 1622
温柔的废话
温柔的废话 2020-11-21 07:55

I know I can set a CSS value through JavaScript such as:

document.getElementById(\'image_1\').style.top = \'100px\';

But, can I

9条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-21 08:22

    If you're into libraries, why not MyLibrary and getStyle.

    The jQuery css method is misnamed, CSS is just one way of setting styles and doesn't necessarily represent the actual values of an element's style properties.

提交回复
热议问题