Last active
March 29, 2017 19:16
-
-
Save lipis/a3b4c40175884e26f277ffc61f230b53 to your computer and use it in GitHub Desktop.
Debug your styles with outline (Copy/Paste the JS in your console and press D)
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
* { | |
outline: 1px solid rgba(251,8,7,.24) | |
} |
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.onkeydown = function(event) { | |
event = event || window.event; | |
// Press 'D' | |
if (event.target.tagName === 'BODY' && event.keyCode === 68) { | |
if (document.styleSheets[0].cssRules[0].selectorText === '*') { | |
document.styleSheets[0].deleteRule(0); | |
} else { | |
document.styleSheets[0].insertRule('* {outline: 1px solid rgba(251,8,7,.24)}', 0); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment