Skip to content

Instantly share code, notes, and snippets.

@JanDW
Last active September 23, 2022 13:47
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 JanDW/35f433cc6a84cd12bad6753febf51513 to your computer and use it in GitHub Desktop.
Save JanDW/35f433cc6a84cd12bad6753febf51513 to your computer and use it in GitHub Desktop.
Applies outline and background-color in order to more readily understand layouts.
if (!document.querySelector("#debugStyles")) {
const style = document.createElement("style");
style.setAttribute("id", "debugStyles");
style.innerHTML = `
.debug-boxes * {
outline: 1px solid blue;
background-color: rgba(0,255,255,.05);
}
`;
document.head.appendChild(style);
console.info("Debug CSS added to document head");
}
$0.classList.add("debug-boxes");
@JanDW
Copy link
Author

JanDW commented Sep 23, 2022

Paste as a snippet in your devtools and select the DOM node subtree you want boxed out and run from the command palette.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment