DEV Community

CSS Got Good While You Were Installing More Libraries

Modern Web Development in 2026

A practical series about building faster, cleaner, more maintainable web applications without chasing every shiny thing.

A lot of frontend habits were formed when CSS was weaker.

We reached for libraries because layout was painful, responsive components were awkward, browser support was uncertain, and the cascade felt like a haunted basement.

That history is real.

But modern CSS is not the same tool many developers learned five or ten years ago.

CSS got good. Quietly. While everyone was arguing about JavaScript frameworks.

The new default: check the platform first

Before installing a styling library, ask:

Can the platform solve this now?

Often, the answer is yes.

Modern CSS gives us better primitives for:

  • responsive components,
  • layout composition,
  • cascade control,
  • design tokens,
  • theme switching,
  • typography,
  • state-based styling,
  • fluid spacing.

Libraries can still be useful. They should not be reflexes.

Container queries change component design

Viewport media queries answer this:

How wide is the screen?

Container queries answer the more useful question:

How much space does this component have?

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

@container (min-width: 42rem) {
  .article-card {
    display: grid;
    grid-template-columns: 14rem 1fr;
  }
}
Enter fullscreen mode Exit fullscreen mode

This makes components more portable. A card can adapt inside a sidebar, dashboard, modal, or full-width layout without pretending the viewport is the only context.

:has() makes parent-aware styling practical

For years, developers wanted a parent selector. Now we have a powerful version of it.

.field:has(input:invalid) {
  border-color: var(--color-danger);
}

.card:has(.card__media) {
  grid-template-rows: auto 1fr;
}
Enter fullscreen mode Exit fullscreen mode

Used carefully, :has() can remove JavaScript that only exists to toggle classes.

Cascade layers make CSS less fragile

The cascade is not bad. Unmanaged cascade is bad.

@layer reset, tokens, base, components, utilities;

@layer tokens {
  :root {
    --space-4: 1rem;
    --radius-lg: 1rem;
  }
}

@layer components {
  .button {
    border-radius: var(--radius-lg);
    padding: var(--space-4);
  }
}
Enter fullscreen mode Exit fullscreen mode

Layers let you define priority intentionally instead of relying on selector combat.

Subgrid fixes a real layout problem

Nested layouts often need to align with parent tracks.

.article-list {
  display: grid;
  grid-template-columns: 1fr minmax(0, 42rem) 1fr;
}

.article-card {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
}
Enter fullscreen mode Exit fullscreen mode

This helps create layouts that feel designed, not merely stacked.

Fluid type without a framework

You can create responsive typography with plain CSS:

:root {
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-3: clamp(1.75rem, 1.25rem + 2vw, 3rem);
}

h1 {
  font-size: var(--step-3);
  line-height: 1.05;
}

p {
  font-size: var(--step-0);
  line-height: 1.7;
}
Enter fullscreen mode Exit fullscreen mode

No runtime. No package. No hydration. Just CSS.

Use Baseline thinking

The modern question is not โ€œCan I use this feature on my machine?โ€

It is:

Is this feature supported well enough for my audience and fallback strategy?

Baseline helps make that decision more systematic, but it does not replace testing. You still need to check accessibility, usability, performance, and your actual user base.

The library decision checklist

Before adding a styling dependency, ask:

  • [ ] Is the problem solved by modern CSS?
  • [ ] Does the library add runtime JavaScript?
  • [ ] Does it make accessibility easier or harder?
  • [ ] Can the team debug the generated output?
  • [ ] Does it work with our design tokens?
  • [ ] Can we remove it later?
  • [ ] Is the dependency worth the long-term surface area?

Final thought

CSS is not just the thing you write after the โ€œrealโ€ engineering is done.

It is a powerful layout and interaction language that now solves problems we used to outsource by default.

Install libraries when they help. But give the platform a chance first.

Sources


Thanks for reading.

You can find me here:

Top comments (0)