CSS

What CSS Can Actually Do in 2026 (Beyond Layout and Colors)

By Ken Key Jul 30, 2025 4 min read Updated Oct 16, 2026

What CSS Can Actually Do in 2026 (Beyond Layout and Colors)
The short answer

CSS in 2026 handles theming with custom properties, component-level responsiveness with container queries, and animations, nesting, and math that used to need JavaScript or Sass. It also does scroll-driven effects, view transitions, and :has() parent selection, so I now write far less JS for UI work.

Part of the complete web design guide.

On this page

Most people still think of CSS as the thing that sets colors and centers divs. That was true in 2010. In 2026, CSS covers a lot of ground that used to require JavaScript, a preprocessor, or a pile of hacks. Here are the techniques I actually reach for on client work, with real code you can drop in today.

Custom properties are a theming engine, not just variables

Custom properties look like Sass variables, but they cascade and can be changed at runtime. That difference matters. You can scope a whole theme to a container or flip it with a single class on the root element.

:root {
 --bg: #ffffff;
 --text: #1a1a1a;
 --accent: #0a66c2;
}

[data-theme="dark"] {
 --bg: #121212;
 --text: #f2f2f2;
 --accent: #4da3ff;
}

body {
 background: var(--bg);
 color: var(--text);
}

a { color: var(--accent); }

Now toggling dark mode is one line of JavaScript that swaps an attribute, and everything downstream updates. No rebuild, no duplicate stylesheet. I’ve used this to ship a dark mode on a site where the design had twenty-plus hardcoded colors. It took an afternoon instead of a week.

Container queries changed how I build components

Media queries respond to the viewport. Container queries respond to the parent element’s size. That sounds small until you build a card that has to look right in a wide sidebar and a narrow grid column at the same viewport width. Media queries can’t do that cleanly. Container queries can.

.card-wrap {
 container-type: inline-size;
}

.card {
 display: grid;
 gap: 1rem;
}

@container (min-width: 400px) {
 .card {
 grid-template-columns: 120px 1fr;
 align-items: center;
 }
}

Browser support has been solid for a while now, so this is safe to use in production. If you’re still writing sixteen breakpoints to handle every card placement, stop.

Scroll-driven animations without a scroll library

For years, fade-on-scroll meant pulling in a JavaScript library or writing an IntersectionObserver. The CSS scroll-driven animation spec lets you tie animation progress directly to scroll position, and it runs off the main thread so it stays smooth.

@keyframes reveal {
 from { opacity: 0; transform: translateY(24px); }
 to { opacity: 1; transform: translateY(0); }
}

.reveal {
 animation: reveal linear both;
 animation-timeline: view();
 animation-range: entry 0% cover 30%;
}

One caveat: check support before you rely on it for critical content. Wrap it in @supports (animation-timeline: view()) and let older browsers show the content in its final state. Progressive enhancement, not a broken page.

Modern layout primitives worth knowing

  • Subgrid lets a child align to the parent grid’s tracks. Great for card layouts where headers, bodies, and footers need to line up across a row.
  • :has() is a parent selector. You can style a form group when its input is invalid, or a card when it contains an image, without extra classes.
  • clamp() handles fluid type. font-size: clamp(1rem, 2vw + 0.5rem, 1.5rem) beats a pile of media queries.
  • Nesting is native now. You can write nested rules without Sass, and it maps closely to what you already know.
/* Style the label only when the input inside is invalid */
.field:has(input:invalid) label {
 color: #c0392b;
}

/* Fluid heading that never gets too small or too big */
h1 {
 font-size: clamp(1.75rem, 4vw + 1rem, 3.5rem);
}

These four alone replace a lot of the utility classes and JavaScript I used to write. Not all of it. But a meaningful chunk.

Where CSS still isn’t the answer

I want to be honest here, because a lot of “CSS can do everything now” posts oversell it. CSS is not a state manager. If you’re building a complex form with validation logic, conditional fields, and server round-trips, JavaScript still owns that. CSS animations also aren’t a substitute for real interaction feedback in a data-heavy app.

The rule I use: if the behavior is visual and tied to layout, state, or scroll, try CSS first. If it involves data, persistence, or logic branching, use JavaScript. Most bugs I see come from putting logic in the wrong layer.

Performance notes that actually matter

A few things I check on every project:

  • Animate transform and opacity, not width, height, or top. The first two skip layout and paint.
  • Use content-visibility: auto on long lists to skip rendering offscreen content.
  • Watch will-change. It’s not free. Set it only where you’re actually animating, and remove it when done.
  • Prefer @layer for organizing styles so specificity stops being a fight. It’s the cleanest way to control cascade order I’ve found.
@layer reset, base, components, utilities;

@layer components {
 .button { background: var(--accent); }
}

@layer utilities {
 .mt-4 { margin-top: 1rem; }
}

Layers let you define the order once. Utilities win over components, components win over base, and you stop writing !important to fix your own cascade.

A quick note on local work

I build and maintain sites from Commack, and a lot of my clients are small businesses across Long Island who don’t have a dev team. The CSS tricks above matter because they cut maintenance cost. Fewer files, fewer dependencies, less to break when a plugin updates. If you want a sense of how I approach Long Island web design, that’s the thread that runs through all of it: use the platform, keep the stack small, ship something that still works in three years.

FAQ

Do container queries work in all major browsers now?

Yes. Chrome, Firefox, and Safari have supported them for a while, so they’re safe for production. Check caniuse for the exact minimum versions if you support older devices.

Should I drop Sass now that CSS has nesting and custom properties?

Not necessarily. Native nesting and variables cover most day-to-day needs, but Sass still offers mixins and functions that plain CSS doesn’t have. For new small projects I often skip the build step entirely. For large design systems, Sass or a token pipeline can still earn its place.

Are scroll-driven animations ready for client sites?

Use them as an enhancement, not a requirement. Wrap them in a feature query so browsers without support show the final state. That way nothing breaks and modern users get the nicer experience.

Have a project like this?

I do Long Island web design for Long Island businesses. If you need this done right, let’s talk.