Last active
February 28, 2020 09:27
-
-
Save nileshbhagwat/c58f696e18dbfa1bbe412c1a054f1c4b to your computer and use it in GitHub Desktop.
Returns 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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getStyle = (el, ruleName) => getComputedStyle(el)[ruleName]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
e.g: getStyle(document.querySelector('p'), 'font-size'); // '14px'