Following the previous video, we'll go through how to design in the browser using more shortcuts and workflow hacks, including some automation software – Keyboard Maestro.
General Tips for Designing
Pop your DevTools “out”—this is a personal preference of mine. It isn't easy to get a clear view of your design when pushed to the side and surrounded by code. You can change how DevTools are displayed by going in the top right > click the vertical dots > and selecting a different docking icon.
Use the Ruler tool—this can really help when trying to make sure elements line up.
To enable the ruler tool, go to the Elements pane in DevTools, press
shift + ?to access preferences > click the
A little trick I've learned is highlighting an element, so the rulers are displayed, then scroll vertically-only; without moving your mouse. DevTools will continue to draw rulers as you scroll to check elements beyond the viewport are lined up.
Maintain your own base CSS file—I personally keep a
core.cssfile, and a
non-core.cssfile. I know I'll use everything in core and quite a lot of things in non-core. This can help kick-start a project, and design in the browser immediately without any set-up.
A good metaphor for thinking about automation and keyboard shortcuts is using a well-known tool like Photoshop of a Word document. If you use these all day, you'll start to get used to some shortcuts. For example, Photoshop has single-key shortcuts for things like Brush tool (b), pen tool (p), Stamp tool (s), Switch colours (x). Word has things like Bold (b), Underline (u).
If you use these tools all day long, it's difficult to do without shortcuts. I feel the same way when designing in the browser—I want as many shortcuts as I can remember to get my ideas out fast.
Here are some convenient keyboard shortcuts that are baked into DevTools:
Incrementing—whenever you're keyboard is focused in a number field you can use the
up/downarrows to increment by 1, and then combine with modifiers like
shiftto increment by 10, or
altto increment by 0.1. This works slightly differently in the Elements panel vs the Sources panel—the Elements panel being slightly superior since there is also the option to increment by 0.1.
Incidentally, you can also use your scroll wheel to go up and down values, again using the modifier keys to change the way the numbers increment.
Previous/Next edit points—Use
alt & -and
alt & +to get to where you were editing previously, or most recently. I find this one particularly useful when working with larger CSS files (like my core.css!) where I'm editing variables at the top of the file and need to get to where I was.
Switching between inspecting and editing—you can use
cmd + 1-9to jump between different panels (you can also rearrange panels to whatever order you want by dragging them around).
This is not turned on by default. To enable this, go to the Elements pane in DevTools, press
shift + ?to access preferences > click the
Enable cmd + 1-9 shortcut to switch panelscheckbox.
I use these shortcuts to switch between inspect mode (the Elements panel) and authoring CSS (the Sources panel).
Automating With Keyboard Maestro
There are a few different automation tools around. TextExpander is probably the most famous. I really like Keyboard Maestro (macOS only, unfortunately – apparently the closest thing on Windows is AutoHotkey). Keyboard Maestro is similar to TextExpander, but its feature set is much much larger, and it pretty much lets you automate whatever you can dream up.
Keyboard Maestro is incredibly handy when it comes to speeding up the authoring experience in DevTools, and you can get a free trial from their website if you're not sure. I have macros that deal with different aspects of authoring:
Text expansions that speed up typing property/value pairs, for example, I might type
pttto have Keyboard Maestro type out
padding-block-start: var(--spacing-somevalue), and place my cursor in the correct position so that DevTools presents me with a list of possible variables.
Utilities such as deleting a line, moving lines up/down, commenting shortcuts, or maybe typing out a media query.
I've attached a sample of my macros below which may help you understand how to speed things up, before tailoring them to your needs.
If you'd like to understand a particular macro included in the attachment, hit me up on Twitter. Also, let me know if you have issues with any macros.