Get Styles of an Element

To get the styles of an element, you use the window.getComputedStyle() method:

let style = window.getComputedStyle(element [,pseudoElement]);Code language: JavaScript (javascript)

The getComputedStyle() method returns a style object that represents the current active styles of an element.

Was this tutorial helpful ?