Issue 18August 2026
Interface cheat sheet
A mix of best practices and personal preferences that help build better interfaces.
User Interface
When nesting elements, make their border radius concentric. The outer radius equals the inner radius plus the padding between the elements.
Prioritize optical alignment over geometric alignment.
A button with text and an icon gets slightly smaller padding on the side of the icon.
Use a layered box-shadow to give elements depth instead of using borders.
Give images a 1px outline, offset by -1px: black at 8% opacity in light mode, white at 8% in dark mode.


Match the icon’s stroke to the text next to it.
Animation
Make elements animate from the trigger rather than the center. Set transform-origin based on the trigger’s position.
For menus people open often, skip the opening animation and only animate when they close.
Make exit animations more subtle than entrances. Move the element by a shorter distance as it fades out with opacity and a 4px blur.
Name the exact properties you want to animate in a transition. Never use transition: all.
Make buttons scale down slightly when pressed. Use a scale between 0.95 and 0.98 with transition: scale 200ms ease-out.
When icons swap, fade one out as the other fades in. Animate the new icon’s scale from 0.25 to 1, opacity from 0 to 1 and blur from 4px to 0px. Reverse these for the old icon.
Use CSS transitions for interactions so the animation can change direction halfway through. Use keyframes for sequences that only run once.
Disable all transitions when switching between light and dark mode.
If an element randomly shifts by 1–2px while animating, add will-change: transform to it. This is especially useful in Safari on iOS.
When elements enter, animate them in small groups with a short delay between each group instead of animating one giant block.
Prevent elements from animating on page load, unless it’s intentional.
Keep frequent interactions instant or very fast, like an item changing color when you hover it.
Typography
Always use .woff2 font files on the web, never .ttf or .otf.
Use font-variant-numeric: tabular-nums in timers, counters, prices and tables. It gives every digit the same width which prevents layout shifts when the values change. Skip it if you’re already using a monospace font.
Keep lines in articles and other long text to 60–75 characters. Long form text that is wider than that is difficult to read.
Lines that run the full width of a wide container, well past 75 characters.
The same text with its measure capped, so each line stays between 60 and 75 characters.
Use text-wrap: balance to even out headings and text-wrap: pretty on descriptions to prevent orphaned words. Use neither for long form text.
- title
- wrap
- description
- wrap
Designing interfaces that feel natural and intuitive
Great design is invisible. It guides users without them ever noticing.
- title
- balance
- description
- pretty
Designing interfaces that feel natural and intuitive
Great design is invisible. It guides users without them ever noticing.
Keep long words, links and IDs inside their container with overflow-wrap: break-word. Use white-space: nowrap to prevent labels and badges from wrapping.
Your API key ak_92hFqL7xVtN3mYc8RwJd5pZk is ready.
Your API key ak_92hFqL7xVtN3mYc8RwJd5pZk is ready.
Set -webkit-font-smoothing: antialiased and -moz-osx-font-smoothing: grayscale on the root layout to make text appear sharper.
Subpixel rendering
Default font smoothing uses subpixel antialiasing on macOS.
Antialiased rendering
Grayscale antialiasing produces thinner, crisper light text.
Write text with normal capitalization. Use text-transform when you want to display it in uppercase or lowercase.
Use smart punctuation: curly quotes, an en dash (–) for ranges, an em dash (—) for asides and an ellipsis (…) instead of three dots.
Keep underlines from crossing the tails of letters like g and y. Use text-underline-position: from-font with text-decoration-skip-ink: auto.
When you shorten text with an ellipsis, let people read the full text in a tooltip or an expanded view.
Designing interfaces that feel natural and intuitive for everyone who uses them.
Colors
Every step in a color palette should have a purpose: page background, component hover, border, solid fill, body text. Don’t add steps that nothing uses.
Components should use semantic tokens (--color-text-secondary), never primitives (--blue-500). The primitive is the raw value, the token is how the value is used.
Name color tokens by purpose: --color-accent-solid instead of --color-blue-button or --color-sidebar-gray.
The name still makes sense when the color changes.
It's called 'blue' even though the color is now violet.
Changing the sidebar color now changes it across the app.
Reserve accent for the brand color so primary never means both the brand and the main body text.
- heading
- --color-primary
- body
- --color-secondary
- button
- --color-primary
- heading
- --color-text-primary
- body
- --color-text-secondary
- button
- --color-accent-solid
Measure contrast against the background directly behind an element.
This text renders on the surface, not the page.
Create a separate color palette for dark mode instead of inverting the light mode palette.
Choose one way to switch themes: prefers-color-scheme or a .dark class. Don’t mix both.
You can define how colors blend in a gradient. Use in oklab for even brightness, in oklch for more vivid colors in the middle or in srgb for more muted midtones.
Accessibility
Use native HTML elements: <button> for buttons and <a> for links, for example. Native elements already have a lot of accessibility and other expected behavior built in.
This side is the same link built from a div with a click handler. Without an href the browser cannot open it in a new tab, offer it in the right-click menu, preview its address on hover or list it as a link.
Style :focus-visible instead of :focus. Don’t remove the outline without a replacement.
Only use tabindex="0" and tabindex="-1". Positive values change the expected order of the elements.
Tab through the buttons to record the order focus visits them.
Tab through the buttons to record the order focus visits them.
Give buttons that only have an icon a descriptive aria-label. Never put aria-hidden="true" on an element that can be focused.
Write alternative text that explains the image’s purpose and what it shows. Give decorative images alt="".

alt="image"
alt="Close up of a focus ring curving around an element's rounded corner"Give every input a visible label using <label>. Set its type and inputmode to match what people should enter.
This field only has a placeholder, which disappears as soon as you type and its text type brings up the generic keyboard on touch devices.
Never block paste. People paste in things like passwords and one-time codes.
Keep the submit button enabled until the request starts. Check for errors when people submit. Mark invalid fields with aria-invalid="true", connect each error message with aria-describedby and move focus to the first invalid field.
Make hit areas at least 24x24px. Aim for 44x44px on touch screens and 40x40px on desktop where possible. Make sure they never overlap.
Use pointer-events: none on decorative elements like glows and gradients so events are never swallowed.
Presses: 0
Put hover styles inside @media (hover: hover). On touch screens, :hover stays active after a tap and makes an item look selected.
Respect people’s reduced motion setting. Put animations inside @media (prefers-reduced-motion: no-preference) so they only play for people who don’t have motion reduced.
Use role="status" to announce routine updates to screen readers. Save role="alert" for urgent errors.
Never use color alone to show a status change. Add an icon, a label or an underline too.
Enter a valid email address
Layout
Use scroll-margin-top to leave space above headings when people follow links to them.
Pricing
Pricing
Leave at least twice as much space between groups as between items in a group. For example, use 8px between items and 16px or more between groups.
Writing
Start button labels with a verb: “Save draft” or “Delete project”, never “OK!” or a bare “Yes”.
Save your changes?
Your draft has edits that are not saved yet.
Save your changes?
Your draft has edits that are not saved yet.
Make confirmation buttons say what will happen: “Delete project” next to “Cancel”.
Delete this project?
This removes the project and all of its files.
Delete this project?
This removes the project and all of its files.
Use the same label to move to the next step throughout a flow. Choose “Continue” or “Next” and use it for every step.
Describe where a link goes.
Click here to learn more.
Read the docs to learn more.
Capitalize buttons, headings and labels the same way everywhere. Sentence case, like “Save changes”, is the safer default.
SETTINGS
Choose Where We Send Updates.
Settings
Choose where we send updates.
Label toggles with what happens when they’re on: “Send read receipts”, not “Disable read receipts”.
When a view is empty, explain what belongs there and give people one action to get started instead of nothing.
No results.
No projects yet
Projects keep your files, notes and tasks in one place.
Address the reader as “you”, not “the user”.
The user will receive an email.
You'll receive an email.
Start building great interfaces today
Quality matters more than it ever has in software. Just building something isn’t enough. If you care about craft, like to sweat the details and want to learn more about design engineering, I think you’ll enjoy the magazine.
Join the other 1,603 readers today!
New issue every month
Resource library
Interactive demos
Source code
Agent skills
Private Discord community
New issue every month
Resource library
Interactive demos
Source code
Agent skills
Private Discord community
Everything in Monthly and Yearly, plus:
Early access to new issues
Lifetime member badge
Vote on upcoming topics
Buying for someone else? Gift a subscription.