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

Yes, I cannot agree more. I did the survey in the vain hope that I could leave a comment or even vote for “no nesting”, i.e. “equivalent CSS”. Most of the given examples are great evidence – some concerningly great evidence – for Tim Petersʼ “flat is better than nested”:

(1 and 2:)

  .foo {
    color: red;

    @nest .parent & {
      color: blue;
    }
  }
(3:)

  .foo {
    color: red;

    {
      .parent & {
        color: blue;
      }
    }
  }
(Without nesting:)

  .foo {
    color: red;
  }
  
  .parent .foo {
    color: blue;
  }
The nested variants, for my sense, foreshadow grave technical debt – in specs, docs, browser code and CSS files.


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

Search: