Home >Web Front-end >JS Tutorial >Summary of native methods for obtaining styles in JavaScript_javascript tips
ps: It is to get the style, not to set the style. If no style value is set for the element, the default value given by the browser is returned. (Forum arrangement)
1. element.style: can only obtain the style value written in the style attribute in the element tag, and cannot obtain the style value defined in and through Loaded style attributes
2. window.getComputedStyle(): can get all the final CSS attribute values of the current element.
3. element.currentStyle: IE-specific, returns the final CSS attribute value currently applied to the element (including external link CSS files,