Hacker News new | past | comments | ask | show | jobs | submit login

CSS has one major drawback - that is, there is no way to compose more complex objects from basic ones.

Say, I have a class:

  foo {
     color: #FF0000;
  }
I want to now apply this class to another class:

   bar(foo) {
      background-color: #000000;
   }
I want to be able to inherit from foo, but I can't do that and that's why we have these shenanigans of composable UI frameworks... there are some advantages to doing everything in the HTML but now we have repeating patterns in the HTML, such as in the OP's link

    <a class="px-4 py-2 border-b-2 hover:border-purple-500 hover:bg-purple-100">Tutorials</a>
    <a class="px-4 py-2 border-b-2 hover:border-purple-500 hover:bg-purple-100">Plugins</a>
    <a class="px-4 py-2 border-b-2 hover:border-purple-500 hover:bg-purple-100">Features</a>
    <a class="px-4 py-2 border-b-2 hover:border-purple-500 hover:bg-purple-100">Blog</a>
which is not extensible and creates duplicate code. You'd still have duplicate class names but I just have to change it once in the css instead of N different places in HTML.






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

Search: