Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> So how can you do that with CSS?

The old:

  .card > .card-header
> The one that hasn't been available in CSS until 2023?

That was nesting, IIRC. Sugar syntax, so you don’t have to fully specified the whole selector.



> .card > .card-header

And we know that it never worked well. That's why BEM and many other naming strategies exist: to try and replicate scoping purely through naming discipline.

> That was nesting, IIRC. Sugar syntax, so you don’t have to fully specified the whole selector.

Nesting partly solves the naming and the "keep all of a component's style close together".

The other partial solution is CSS Scoping: https://developer.mozilla.org/en-US/docs/Web/CSS/@scope

And this still doesn't solve the issue of repetition where every component has to spell out the margins, the paddings, the borders, the...




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: