Created
October 9, 2019 02:56
-
-
Save cvan/c014e899e70274a37ca5ec015aecbf56 to your computer and use it in GitHub Desktop.
CSS debugging tool: a visual `font-size` helper
This file contains hidden or 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
[data-font-size]:after { | |
background: rgba(255,50,190,.9); | |
color: #fff; | |
content: attr(data-font-size); | |
} |
This file contains hidden or 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
[...document.querySelectorAll('*')].forEach(el => { | |
const styles = window.getComputedStyle(el); | |
el.setAttribute('data-font-size', styles.getPropertyValue('font-size')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment