Window.getComputedStyle()
to get the value of the CSS rule for the specified element.const getStyle = (el, ruleName) => getComputedStyle(el)[ruleName];
getStyle(document.querySelector('p'), 'font-size'); // '16px'
Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️