Retrieve the value of a CSS rule for the specified element Use Window.getComputedStyle() to get the value of the CSS rule for the specified element. const getStyle = (el, ruleName) => getComputedStyle(el)[ruleName]; // EXAMPLE getStyle(document.querySelector('p'), 'font-size'); // '16px' Source https://www.30secondsofcode.org/js/s/get-style