Good CSS from a design starts with reading the design as a system, not a picture. Before writing a single rule, identify the layout grid, the spacing scale, the type scale, the color roles, and the repeating component patterns—then encode those decisions as reusable tokens and small, composable classes. The key condition is discipline: every value you hard-code is a decision you'll have to make again in six months, so the goal is to translate each visual decision once and reuse it. This guide walks through a repeatable process, from design handoff to production CSS, aimed at front-end developers working from Figma, Sketch, or similar design tools in late 2026, with plain, evergreen CSS principles that apply between major browser releases.

Start by Reading the Design as a System

The most common failure in translating a design to CSS is treating each screen as a one-off composition. Designers who work in component-based tools usually build screens from a library of reusable pieces—buttons, cards, fields, nav bars. Your CSS should mirror that mental model. If it doesn't, you'll produce styles that look right once and break on the next screen.

Look at the design files and inventory a few categories:

Layout containers: page shells, section wrappers, grids, sidebars. Recurring components: buttons in every state, form fields, cards, tables, modals, badges. Text roles: display headings, body copy, captions, labels, error messages. Color roles: primary action, secondary action, surfaces, borders, text levels, feedback states. Spacing and radius values: the same few numbers appearing repeatedly.

You're looking for repetition. Any value that appears three or more times is probably a token. Any component that appears in multiple contexts is a candidate for a reusable class or component.

What to ask the designer (or check in the file)

Good CSS depends on knowing intent, not just pixels. Ask, or infer from the design file:

1: Is there an underlying grid, and what are the breakpoints? 2: What is the type scale (base size, ratio, weights)? 3: What's the spacing scale—is it a consistent 4 or 8 pixel base? 4: Which colors are semantic (primary, danger, success) versus brand-only? 5: Which components have states beyond the default (hover, focus, disabled, error, loading)? 6: What's the responsive behavior—does the layout reflow, hide, or reconfigure?

If you can't get answers, infer from a careful read of multiple screens. A pattern that recurs consistently is almost certainly intentional.

Extract Tokens Before You Write a Single Rule

Tokens are the single source of truth for design values. Whether you express them as CSS custom properties (--color-primary) or as SASS variables, the principle is the same: define once, reference everywhere. Modern browsers support custom properties in all evergreen engines, so plain CSS variables are a solid default.

A minimal token set for a typical project looks like this:

A few practical notes. The hex values above are illustrative—copy the exact values from your design system rather than these. If the design gives you a color like #1f5fdf, store it under a semantic name and keep the raw hex in the token. That way, if the design changes, you update one line and every rule that references --color-primary follows. Don't name tokens by appearance (--blue-500) if you can name them by role (--color-primary)—the role survives redesigns; the color doesn't.

If the design file uses rem-based type and spacing, keep your tokens in rem. If it uses pixels, convert once at the token layer, not in fifty rule blocks. The conversion is trivial: 16px is 1rem at the browser's default font size. Users may bump their default font size; rem scales with their preference, while px for text does not. Spacing in px is fine for structural values, but be consistent.

Tokens are not a style guide yet

A common mistake is treating tokens as the entire answer to "good CSS." They aren't. Tokens tell you which values to use; they don't tell you how to apply them. Two components can both use --space-4 and --color-border and still produce inconsistent results if their padding, border, and hover behavior are decided ad hoc. The next step—components—is where consistency actually lives.

Build Layout First, Skin Second

Layout is the hardest part of CSS to fix later. A design that feels wrong usually has a structural problem, not a color problem. Get the container model, grid, and breakpoints right before you fuss over shadows.

Establish the page shell

Read the design for a page-level pattern. Most marketing and app UIs follow a shape like:

A full-width header, sometimes with an inner max-width container. A main content area, often constrained to a maximum width (e.g., 1,200px) and centered. Full-bleed sections inside the main area for backgrounds. A footer with its own inner container.

Encode that shell once:

margin-inline: auto centers the container; padding-inline guarantees breathing room on small screens. This is a single class that solves most of the horizontal layout problems you'd otherwise fix section by section. Notice it uses tokens for spacing and a real breakpoint from the design—not a magic number.

Choose grid vs. flex per problem, not by preference

Flexbox and Grid each have clear strengths. Use flexbox for one-dimensional flow: a row of buttons, a nav bar, a card's internal stack. Use grid for two-dimensional layouts: page-level grids, galleries, dashboard columns, and any case where you want row and column alignment at once.

A card in the design often looks like:

That single line gives you responsive columns. As space shrinks, fewer fit; as it grows, more appear. You only add breakpoints when the design demands a different arrangement (e.g., "sidebar appears at tablet"), not when you could let the grid reflow naturally.

Check the design's breakpoints against real behavior

Designers often deliver frames at, say, 375, 768, and 1,440 pixels. Those are common reference widths, not sacred. Use them as starting points but test at intermediate widths—600px, 1,024px, 1,280px. If a layout feels cramped between two frames, the design has a gap. Fix it with a small tweak (usually an extra min-width query or a minmax() adjustment) rather than assuming the frames are complete.

Write CSS in Layers: Reset, Base, Components, Utilities

Layered CSS is easier to reason about, easier to override, and easier to delete. You can implement layering with cascade layers (@layer), or just with a disciplined file order—both work. Here's the model:

1: Reset / normalize: browser default handling. 2: Base: element styles—headings, paragraphs, lists, links, form controls. 3: Layout: containers, grids, page shells. 4: Components: buttons, cards, navs, forms. 5: Utilities: small single-purpose classes for exceptions.

Reset and base

A minimal reset doesn't need to be long. Modern resets typically set box-sizing on everything, zero out some margins, and normalize a few form elements. A pragmatic base:

That covers 90% of the "why does this look slightly wrong" issues in raw HTML. If the design specifies a custom font, load it once and put it in the font-family stack. Don't sprinkle font families across components.

Why layering matters even without @layer

Without cascade layers, order carries the specificity. Because utilities come last, they override component defaults; because components come before utilities, they can't accidentally knock out utility classes. If you use @layer, the same principle applies with named layers, which makes overriding predictable and removes many !important temptations. If you're building a smaller codebase, a documented file order achieves the same thing.

Component CSS: Predictable Anatomy, Modest Selectors

Components are where most CSS quality gets decided. A good component class has clear responsibilities, uses tokens, and doesn't reach outside itself. Bad components are usually either too specific (.dashboard .sidebar .nav ul li a.active) or too generic (.button doing six different things).

Anatomy of a good component

A button is a useful small example because it exposes the key decisions: size, color, state, and variant.

A few deliberate choices: sizes and colors come from tokens, the focus ring is defined explicitly (never rely on browser defaults, which vary), and disabled state is a real, tested state—not a guess. The --primary / --secondary variant naming is BEM-ish and easy to read; you can choose a different convention, but choose one and stick to it across the project.

Prefer flat, qualified selectors

You can nest these notationally with a CSS preprocessor or native nesting for authorability, but the compiled output should be flat. Flat classes have less specificity, which means future overrides are easier, and you're not painting yourself into a corner by tying styles to a DOM path.

States are part of the component

Designers often show default, hover, focus, active, disabled, and error states. Build every one you see. The missing state is almost always the one that ships to production. Include at least:

:hover for interactive surfaces. :focus-visible with a visible ring (never remove focus outlines without replacement). :active where it reads as press. [disabled] or :disabled with visual treatment. Error variants on fields, with both visual treatment and an actual message.

Responsive and Accessibility Checks That Catch Real Problems

Responsive design is not a section you bolt on at the end. It's a set of constraints on how you write layout from the first component. Accessibility, similarly, is cheaper to write in than to retrofit.

Mobile-first media queries

Write base styles for the narrow case, then add queries for larger widths. It's the opposite of many design workflows but it produces less override code.

That's simpler than trying to undo desktop styles. Fewer overrides, fewer bugs. If the design only shows desktop and mobile frames, sketch the intermediate state yourself—usually a subtle adjustment in spacing or stacking.

Accessibility you can add while styling

A handful of habits catch most issues:

Contrast: measure text against its background. WCAG AA requires 4.5:1 for normal text and 3:1 for large text (18.66px bold or 24px regular and up). Colors in design files aren't always checked; do it yourself. Focus visibility: always keep a visible ring. A rule like a { outline: none; } without a replacement is a real bug. Don't hide content with color alone: state indicators need text or icons too. Hit targets: interactive elements should be roughly 24×24 CSS pixels or larger. Reduced motion: wrap larger transitions in @media (prefers-reduced-motion: reduce).

A quick check: load the page in a browser, tab through. Every focusable element should show where it is. Zoom to 200% and check nothing breaks. Those two checks catch a remarkable number of accessibility failures before a formal audit.

Common Failure Modes and How to Fix Them

Even with a system, projects get into trouble. The common patterns are worth naming, because they're easy to avoid once you can spot them early.

"The CSS got unwieldy"

Signs: dozens of !important, styles overriding styles, selectors six levels deep, values like margin-top: 27px scattered around. Cause: likely added specificity instead of correcting structure.

Fix: start from the tokens and components. If you need !important, ask why the loser didn't lose naturally—often the underlying selector was too specific. If spacing looks wrong, check whether the design's scale actually supports that value; 27px usually means rounding drift, not design intent.

"It looks right at one breakpoint and broken at another"

Cause: layout written to match a single frame instead of a flexible model. Fix: use grid and flex for reflow wherever possible; add breakpoints only where the design genuinely changes shape. A minmax() grid and a couple of media queries often replace twenty hard-coded widths.

"The design updates and I have to rewrite everything"

Cause: values baked into component styles instead of central tokens; variants not modeled. Fix: audit for hard-coded values. Every color:, background:, padding:, font-size: and border-width: should either reference a token or be a genuinely unique value. If a designer changes the primary color, you should be able to update one line.

A quick self-review checklist

Before merging CSS for a screen, run through:

1: Any hard-coded color that isn't a token? Move it. 2: Any hard-coded spacing value used more than twice? Move it. 3: Every interactive element has :hover and :focus-visible behavior. 4: The screen looks correct at 375, 768, 1,024, and 1,440 pixels wide. 5: Text contrast passes AA; no color-only state indicators. 6: Utilities are small and single-purpose; no utility classes with !important unless justified. 7: File order/@layer order is intact and imports haven't drifted.

That's a short check, but it catches most structural problems early, when they're cheap to fix.

A Worked Example, Scaled Down

To see the whole flow, consider a small "notification banner" that appears in a design. The design shows: a full-width container with a light-blue background, an icon on the left, a bold heading, one sentence of body text, a dismiss button on the right, and a border-radius of 8px with 16px padding.

Reading the design as a system:

Background color is probably one of the feedback colors, not brand. Use a token like --color-info-surface. Radius is --radius-md (if your scale maps 8px to md). Padding is --space-4. Text roles: heading likely --text-base bold; body --text-sm at --color-text. Dismiss button behavior is a variant—small icon button, focus ring required. Responsive: icon and text should wrap, dismiss button stays visible.

A reasonable implementation (omitting the icon-button styles and icon asset for brevity):

That's the whole process in miniature: identify the repeating values, map them to tokens, build a flat component with explicit states, add the responsive constraint (flex, min-width: 0 to prevent text overflow from squeezing the button), and test it at multiple widths.

If you're building more than a handful of screens, this discipline compounds. The token set becomes a shared vocabulary between design and code; a new component usually takes minutes, not hours; and a redesign is a token update plus a few targeted edits, not a rebuild. That's what "good CSS from a design" ultimately means in practice.

The rest is repetition. Each new screen adds new components and crystallizes tokens you miss. Each review pass catches hard-coded values that slipped through. Over a dozen screens, the system converges—not because any single step is clever, but because the process refuses to hide decisions. That's the habit worth building.