JavaScript - get CSS style
Table of Contents
#
JavaScript - get CSS style
Sometimes i want to use JavaScript get dom CSS style.
Use DOM.currentStyle
and window.getComputedStyle(DOM)
For IE use DOM.currentStyle
Other use window.getComputedStyle(DOM)
var dom = document.getElementById("target"),
style = dom.currentStyle || window.getComputedStyle(dom);
console.log(style.marginTop);