Skip to content

Instantly share code, notes, and snippets.

@cvan
Created October 9, 2019 02:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cvan/c014e899e70274a37ca5ec015aecbf56 to your computer and use it in GitHub Desktop.
Save cvan/c014e899e70274a37ca5ec015aecbf56 to your computer and use it in GitHub Desktop.
CSS debugging tool: a visual `font-size` helper
[data-font-size]:after {
background: rgba(255,50,190,.9);
color: #fff;
content: attr(data-font-size);
}
[...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