This study compares two websites with similar design: the commercial Spotlight template from developers of Tailwind vs the same site with semantic CSS.

  • bonus_crab@lemmy.world
    link
    fedilink
    arrow-up
    4
    arrow-down
    2
    ·
    8 months ago

    Having used it in a major project its a shame that its so inefficient because the user experience really is much much better. It feels like a successor language to CSS because it fixed lots of unobvious and badly named attributes and makes lots of things just easier.

    The code is more verbose but also you can completely understand how the page will look just by reading the html.

    That said it makes sense the performance is so much worse, where you would have matched on one class for N styles you now match on N classes for N styles.

    Theoretically its totally possible to do that matching at compile time and ‘compile’ the string of classes you wrote into individual ones per element for each combination used in the html though.

    • Kissaki@programming.dev
      link
      fedilink
      English
      arrow-up
      6
      arrow-down
      1
      ·
      8 months ago

      you can completely understand how the page will look just by reading the html

      You lose being able to read meaning and structure though, and you also lose technical accessibility.

      I like to add css hacks to websites. But I can’t if they don’t have useful, identifying, and stable selectors.

      • bonus_crab@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        8 months ago

        not really if you use a web framework and actually separate different things into their own components.

        but yeah mixing non tailwind css into a tailwind project after the fact would be gross and hard.

    • spartanatreyu@programming.dev
      link
      fedilink
      arrow-up
      2
      arrow-down
      1
      ·
      8 months ago

      Tailwind is only feels like a successor to CSS to developers writing css like it was 10 years ago (or using frameworks that write it like that, e.g. bootstrap), or projects not using visual regression testing.

      Modern css is so much better.

      • Want to position, overlap, or align things? Use CSS Grid.
      • Are you using a CMS or component system and want to change the order that CSS is applied? Use Cascade Layers.
      • Want to have resizeable components? Use component queries.
      • Want to make a change all through your site? Use custom properties.
      • Want to style things differently based on how many other elements are inside or around it? Use :has(), +, ~, nth-..., … selectors.

      If you’re using something like BEM, or bootstrap to make columns, your knowledge is way out of date and you’re doing it wrong.

      • darkpanda
        link
        fedilink
        arrow-up
        2
        ·
        8 months ago

        The performance improvements in v4 are for compilation times, not rendering.