thanks, made a toggleable bookmark (no need for an extension) with this + another CSS I was using (that removes background + adds a red outline). looks like this:
Here a slightly improved variant which loads faster and does not break elements with Javascript events on the page: gist.github.com/olee/50f0ddac55418...
Just noticed your post after I already fixed it for myself as well. But in mine I took off the added code to remove background images. Removing background images is not desirable in a lot of cases, especially web apps.
Here's my code: gist.github.com/growthboot/5c189cf...
And to compare I use lavenderblush. I know it’s really pastel, but most of my web dev is on bright background, so using red or blue is like poking myself in the eye with a pen.
There's also a plug in called Pesticide (Chrome) & Open Pesticide (Firefox) that does this by showing you the size of all divs in your page. Really handy for identifying which div is causing the bug.
Because we always have html and body as parents wrapping everything (associated with layout), first two rules just add 2 extra layers of background, selecting everything under body would allow going nine levels inside body 😄
body * { background-color: rgba(255,0,0,.2); }
body * * { background-color: rgba(0,255,0,.2); }
body * * * { background-color: rgba(0,0,255,.2); }
body * * * * { background-color: rgba(255,0,255,.2); }
body * * * * * { background-color: rgba(0,255,255,.2); }
body * * * * * * { background-color: rgba(255,255,0,.2); }
body * * * * * * * { background-color: rgba(255,0,0,.2); }
body * * * * * * * * { background-color: rgba(0,255,0,.2); }
body * * * * * * * * * { background-color: rgba(0,0,255,.2); }
Nice :) Another similar hack I frequently use is using a repeating svg grid as html background against body with reduced transparency. Helps a lot with alignment issues. lorefnon.tech/2019/01/12/using-an-...
Instead of copy-pasting the sniplet you could add it as a user-style for example to Stylus browser extension and just toggle it. (Just did that myself…)
Interesting, thank you for sharing this! Whenever I think I know what CSS is all about I learn about a new hack I would never even think of, CSS is definitely more interesting than it seems.
Seeing all those universal selectors made my eye start to twitch, and then I read what you are using it for. This is pretty interesting. Sharing with my team
Technical SEO building open-source tools in Rust for web content extraction and analysis. Author of rs-trafilatura and the WCXB benchmark. Interested in information retrieval, ML, and SEO at scale.
"Web-Stack" developer with a focus on accessibility design and development patterns, data visualization and DevOps automation.
Fell in love with Node, JS, SPA's and the JAMStack. Bye LAMP.
Front-End Developer, Web Designer, Audio Engineer, Digital Creative — I create web applications and websites with performance, elegance, and aesthetic.
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
11 plus years* active enterprise development experience and a Fine art degree 🎨
Oh thank goodness your not going to use this in prod! I have seen some developer tools do something similar. I think browsersync admin does have utils like this too.
I design compilers, write mobile and web apps, make distributed apps, develop augmented reality and design. I write, paint and read. A lot. Huge Linux enthusiast.
Blog: https://nirlanka.com
thanks, made a toggleable bookmark (no need for an extension) with this + another CSS I was using (that removes background + adds a red outline). looks like this:
code here
Here a slightly improved variant which loads faster and does not break elements with Javascript events on the page:
gist.github.com/olee/50f0ddac55418...
Just noticed your post after I already fixed it for myself as well. But in mine I took off the added code to remove background images. Removing background images is not desirable in a lot of cases, especially web apps.
Here's my code:
gist.github.com/growthboot/5c189cf...
Very cool, you can run it on any page from the browser dev console.
Thanks for posting the code.
I love it!!!. Your bookmarklet is very handy. Thank you.
Thanks for sharing!
Much quicker to do the following imo:
It will produce something like this:
Thanks man..
border:1px solid redis the console.log for me in css 🤣outline: 1px solid #f00is my go-to for this since the outline doesn't affect size, and#f00is just kinda fun to type instead of red :)Borders will potentially change the layout of some elements. Use outline instead!
border-boxis slightly better since that does not affect the box-sizes. And using a weird color like light-green works usually best for me.It's like somebody read my mind! :D
Ah, very interesting... I usually resort to adding:
to whatever I'm currently debugging 🤣
This seems like a more sane alternative... :)
My color of choice is
background-color: aliceblue, it’s softer on the eyes 😁Never even knew that was a color, heh... it is quite nice 😁
And to compare I use
lavenderblush. I know it’s really pastel, but most of my web dev is on bright background, so using red or blue is like poking myself in the eye with a pen.You might find this interesting jezebel.com/the-history-of-pink-fo... (on the subject of colour and gender identify).
Whoops. I mindlessly used a gender assumption, I apologize. I've edited the original comment. Thanks for pointing it out :)
There's also a plug in called Pesticide (Chrome) & Open Pesticide (Firefox) that does this by showing you the size of all divs in your page. Really handy for identifying which div is causing the bug.

Sweet!
I have a contrib...
Because we always have
htmlandbodyasparentswrapping everything (associated with layout), first two rules just add 2 extra layers of background, selecting everything under body would allow going nine levels inside body 😄Nice :) Another similar hack I frequently use is using a repeating svg grid as html background against body with reduced transparency. Helps a lot with alignment issues. lorefnon.tech/2019/01/12/using-an-...
Ha, nice! I created a Chrome plugin, simple-debug.css, a few years back that does something similar with the following CSS:
lol just wanted to post that idea here.
The VisBug chrome extension is also amazing for CSS stuff
makes me regret developer.mozilla.org/en-US/docs/T...
wanted to share exactly that.
Reminds me of Addy's CSS Layout debugger
gist.github.com/addyosmani/fd3999e...
My mind has been officially blown! How have I not found this sooner??
I've added more nested levels to accommodate some deeper levels of the dom, but that's a simple copy and paste job from the code above.
I'll be adding the bookmark for sure!
good tip, but never can replace the classic: *{outline: 1px solid red} :)
outline: 1px solid red; is my css equivalent to console.log() 😂
Nice! I've seen similar variations of this sort of thing, but this is the cleanest.
I feel like it could be useful to toggle this via a browser extension.
This works as a regular bookmark, and can toggle it, without using an extension.
dev.to/vcastroi/comment/f0a4
Instead of copy-pasting the sniplet you could add it as a user-style for example to Stylus browser extension and just toggle it. (Just did that myself…)
Thanks for the idea!
I believe a similar is built into the Firefox dev tools. (Also I find their dev tools better than Chrome).
It was called 3d tilt or something like that. Very cool feature that was unfortunately discontinued.
I use pesticide for chrome. I get too anxious adding stuff like this to my codebase 😂
Firefox added a clickable element to the dom for flex box and grid.
developer.mozilla.org/en-US/docs/T...
CSS is really great for inspection. Have you checked out older debugging or quality control style sheets like github.com/j9t/qa-style-sheet (mentioning because it’s quite comprehensive but can also use backup) or classic meyerweb.com/eric/thoughts/2007/09...?
Interesting. I am working on the developer tools for Edge and this might just be an interesting option to add.
I will take the credit any time of the day. :-)
Thank you for this tip.
VERY interesting and cool. Thanks for this!
I've created simple chrome extension for this to toggle on websites
github.com/iamarek/css-debugger
I do this often and I just add a new style rule directly in devtools as simple as
*{box-shadow: 0 0 0 1px red}Thank you! This is very useful!
Wow so nice!!! If you dont mind,may I translate this into Korean so that others can also read it?
Of course. Just share a link back. :-)
medium.com/%EC%96%B8%EC%96%B4%EC%9...
here!
Interesting, thank you for sharing this! Whenever I think I know what CSS is all about I learn about a new hack I would never even think of, CSS is definitely more interesting than it seems.
Genuis!
Seeing all those universal selectors made my eye start to twitch, and then I read what you are using it for. This is pretty interesting. Sharing with my team
A great little tip.
Wow, I'm gonna give this a try, and will probably use it from now on -
Thanks for sharing
It's an amazing trick!
pretty cool!
Wow! That was super helpful. Thanks :)
ohhhhhhhhhhhhoo, You just popped up my mind, Thanks, man!
I had enlightenment, thank you! ❤️
thanks a lot, sir.
Thanks for the tip!
This is epic. Well done! Super useful!
Nice hack. It can be extension or something for debugging.
Awesome thanks!
Clever
This is great, I wrote a quick extension
chrome.google.com/webstore/detail/...
Or just use grid
Chris Pederick's Web Developer extension's Outline tab has had this and other features for many years... :)
You can the same thing quite easily with chromes developer tool right?
Lol,
Pesticide anyone?
Amazing!Like it :))
Thanks for sharing!
Definitely going to use this on future projects, thanks for sharing!!!!
Oh thank goodness your not going to use this in prod! I have seen some developer tools do something similar. I think browsersync admin does have utils like this too.
I was skeptic first, but then realized how much it makes sense. Great have!
It's so nice! :)
Thank u, this helps a lot
So good.
I use pesticide chrome extension, and I love it.
Anybody have something similar for React Native?
Great idea to add to my artillery.