All posts
CSS

The Future of CSS: What Excites Me

Sep 20256 min read

CSS has had more significant updates in the last three years than in the previous decade. The language is evolving at a pace that's genuinely exciting — and it's solving problems that previously required JavaScript.

Container Queries: The Missing Piece

For years, we've been building responsive layouts based on the viewport width. But components don't live in viewports — they live in containers. A card component might appear in a full-width hero, a 3-column grid, or a sidebar. Each context demands different styling.

Container queries finally let us style based on the parent's size:

css
.card-container {
  container-type: inline-size;

@container (min-width: 400px) { .card { display: grid; grid-template-columns: 200px 1fr; } } ```

This is genuinely transformative for component-based architecture. Components become truly self-contained — they adapt to their context without media queries that assume a specific layout.

Scroll-Driven Animations

This is the one that excites me most. Previously, scroll-linked animations required JavaScript — IntersectionObserver for triggering, scroll event listeners for progress-based effects, or libraries like GSAP ScrollTrigger.

Now CSS can do it natively:

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

.section { animation: reveal linear both; animation-timeline: view(); animation-range: entry 0% entry 100%; } ```

Zero JavaScript. Hardware-accelerated. Buttery smooth. The performance implications alone are massive — these animations run on the compositor thread, completely off the main thread.

View Transitions API

Page transitions have always been a pain point on the web. SPAs use JavaScript-heavy solutions. MPAs had nothing. The View Transitions API changes both:

css
::view-transition-old(page) {
  animation: slide-out 300ms ease-in;

::view-transition-new(page) { animation: slide-in 300ms ease-out; } ```

Combined with Next.js or any modern framework, this enables native-feeling page transitions with minimal code.

The :has() Selector

Sometimes called the "parent selector," :has() is arguably the most powerful CSS selector ever created. It lets you style an element based on its descendants:

css
/* Style a form differently when it contains an error */
form:has(.error) {
  border-color: red;

/* Full-width layout when image is present */ .card:has(img) { grid-column: span 2; } ```

This eliminates entire categories of JavaScript that existed solely to toggle parent classes based on child state.

What This Means

The trend is clear: CSS is absorbing capabilities that previously required JavaScript. This isn't just about writing less code — it's about performance, accessibility, and progressive enhancement.

CSS-only solutions work without JavaScript loading. They're accessible by default. They degrade gracefully. And they run on the browser's optimized rendering pipeline.

The future of frontend development isn't less CSS — it's more CSS, better CSS, CSS that does things we never thought possible in a stylesheet. And I'm here for it.

© 2025 Bilal

All posts