Let’s look at some ways we can use the browsers DevTools to do design work. There are a few somewhat hidden tricks you mind find handy!
Toggling Classes With Checkboxes
This is useful when trying to pick a design from different options or to toggle the active state of an element without adding the class manually in DevTools.
To achieve this, we could use different classes and scope styles inside them. So if we want to see different options for a banner design, we could so something like:
.banner-1 {
/* Style variation */
}
.banner-2 {
/* Style variation */
}
Google Chrome gives us the ability to add all of these classes and toggle (show/hide) them with a checkbox to make a quick comparison between them.
See the demo Pen.
Editing Content with designMode
Web content is dynamic, so our design should be flexible and we should test for various types and lengths of content. For example, entering a very long word might break a design. To check that, we can edit our design right in the browser with document.designMode
.
This can help us test our design without editing the content manually in the source code.
Hiding Elements
Sometimes we need to hide elements in our design to check how it will look without them. Chrome DevTools give us the ability to inspect an element and type h
from the keyboard to hide it by toggling CSS visibility property.
This is very useful in case you want to hide some elements to take a screenshot and then discuss it with your team/designer/manager. Sometimes I use this feature to hide elements and then take a screenshot to mock a quick idea in Photoshop.
Screenshotting design elements
There is a useful feature in Firefox DevTools to take a screenshot of a specific element in the DOM. By doing that, we can compare our variations side by side to see which one is the best of our case.
Follow the below steps:
- Open Firefox DevTools
- Right-click on an element and pick Screenshot Node
- The screenshots are saved in the default downloads folder

If you want to use Chrome for screenshotting, you can. There is a plugin called “Element Screenshot” that does almost the same job.
Changing Design Colors
In the early stages of every design projects, you might be exploring different color palettes. CSS’ hue-rotate
function is a powerful filter that provides us with the ability to change design colors right in the browser. It causes hue rotation for each pixel in an image or element. The value can be specified in deg
or rad
.
In the below video, I added filter: hue-rotate(value)
to the component, notice how all the colors change.
Notice that every design element got affected from applying hue-rotate
. For example, the user avatar colors looks wrong. We can revert the normal look by applying the negative value of hue-rotate
.
.bio__avatar {
filter: hue-rotate(-100deg);
}
See the demo Pen.
Using CSS Variables (Custom CSS Properties)
Even if the support is still not perfectly cross-browser friendly (it’s currently in development in Microsoft Edge), we can get the benefit of CSS variables today. Using them to define the spacing and color units will make it easy to make huge changes by changing tiny values on the fly.
I defined the following for our web page:
:root {
--spacing-unit: 1em;
--spacing-unit-half: calc(var(--spacing-unit) / 2); /* = 0.5em */
--brand-color-primary: #7ebdc2;
--brand-color-secondary: #468e94;
}
These variables will be used throughout the website elements like links, nav items, borders and background colors. When changing a single variable from the dev tools, all the associated elements will be affected!

filter: invert()
Invert elements with CSS This is useful when you have a white text on black background or vice versa. For instance, in the header, we have the page title in white on a black background, and by adding filter: invert
to the element, all the colors will be inverted.

CSS Visual Editor
This feature is becoming better every day. Safari has really nice UI tools for editing values. Chrome is adding similar things slowly to DevTools.
Chrome has some cool stuff for things like box-shadow
, background-color
, text-shadow
and color
.

I think this will be very useful for designers who doesn’t know much about CSS. Editing things visually like that will give them more control over some design details, they can tweak things in the browser and show the result to the developer to be implemented.
Awesome!
Editing content with design mode, whaaat? That right there was worth the price of admission. Thank you sir for the insight.
Yeah, that’s not a very well known one. IIRC, it’s basically a JavaScript equivalent of the
contenteditable
attribute in HTML. And just likecontenteditable
, you can select text and hit ctrl-b or ctrl-i on your keyboard to add bold and italics. Not sure if there are any other keyboard shortcuts like that though.Also, using
document.designMode
allows us to spell check any existing document we have already published.Great post, thanks!
Great idea! Thank you for reading :)
Wow how did I not know about the design mode! Very useful. Thanks for sharing
I frequently will write my CSS straight in the browser and then copy and paste it to my editor afterwards. Doing so not only has the benefit of real-time feedback, but means that if you screw something up, you’re only a refresh away from having things back the way they were.
Just in case you are not aware of it, you can Set Up Persistence with DevTools Workspaces.
I LOVED this article, great tips. I’ve been writing CSS for many, many years and I didn’t know many of them! Thanks!
Glad you found it useful! Thank you for reading.
So CSS Visual Editor is not available in chrome for margin like it is shown in screenshot ? I tried checking in firefox as well but no luck. Any one here can explain.
The CSS Visual Editor was for Safari. Chrome had some nice UI stuff but not the same thing.
“Editing Content with designMode”
alternatively, just select the element and edit its content in Elements explorer. No need to turn on document.designMode
That’s what I’ve been doing too!
Cool to learn about document.designMode though. Bunch of neat tricks in this article.
You’re 100% right! Sometimes I need to edit the content of different elements in the DOM so I feel lazy to go through all of them. :D Adding this line of code will give me the ability to edit anything quickly.
Thanks for reading. :)
Great article, always nice to learn something new with DevTools. The ‘h’ trick was easy to miss, thank you!
Also, very nice to share some insight for the tools of browsers other than Chrome – I bet most of us use Chrome as their primary development platform, but let’s not forget there are other browsers and other DevTools. That element screenshot from Firefox is golden!
On a final note, I’m quite puzzled by the fact that so many developers still don’t know about
designMode
– it’s been there for literally more than a decade, back when IE was king of browsers. Well, I guess this blog being CSS tricks, most readers are CSS developers, while this technique has its root in a quite uncommon JavaScript feature.I’d like to add that if you want to change the content of a single element, you can select it in the element tree and type
$0.contentEditable = true
in the console, or add thecontenteditable
attribute directly from the element tree.Wow! This tip is so useful, I learned something new. Thanks a ton for sharing! :)
Just wanted to add that “Hiding Elements with H” and “designMode” are working in firefox! not only chrome.
I’m already used to some of them.
But come on, document.designMode is a beast! That’s really good, and pretty suitable for case testing on string limit and other experiments.
Yes! :D
These tips are great. I recently gave a talk that cover a lot of these and more. Here is a screencast of my talk, I hope someone finds it helpful.
Thanks a lot for sharing, excited to watch the talk! :)
Firefox is really going for it in this area. The tools are amazing and I feel the same about this as I had when I found live reload.
Thanks for sharing. Always glad to learn something new :-)
There’s also a visual bezier curve editor for animation easings in Chrome DevTools.