I am not allowed to credit the site that has this disaster. Its owner said “Nobody should see that”

  • drathvedro@lemm.ee
    link
    fedilink
    arrow-up
    19
    ·
    4 months ago

    I’m appalled that classes representing visual styles are still a thing. I thought everyone already figured that it was a bad idea back in bootstrap days. But then I recently had an opportunity to work on project that uses Vuetify and saw quite long poems about flexboxes in class names…

    • Ephera@lemmy.ml
      link
      fedilink
      arrow-up
      4
      ·
      4 months ago

      Well, there’s not exactly a class training you have to take before writing CSS, so everyone starting out with it gets to make all those same mistakes for themselves before they know how to use classes sensibly. I myself am some backend guy, who has to write CSS far too often.

      It certainly also does not help that various CSS frameworks out there do exactly that…

      • bleistift2@sopuli.xyz
        link
        fedilink
        English
        arrow-up
        3
        ·
        4 months ago

        It certainly also does not help that various CSS frameworks out there do exactly that…

        Bootstrap (as of v5) being one of them. div class="d-flex gap-2 my-3 align-items-center flex-nowrap justify-content-between

        I was annoyed at this at first, but I’ve since noticed that I write hardly any CSS any more, because most rules really are “just add some space, vertically align, be red”.

        • Ephera@lemmy.ml
          link
          fedilink
          arrow-up
          7
          arrow-down
          1
          ·
          edit-2
          4 months ago

          Yeah, the reason why people deride it, is because it’s practically equivalent to:

          div style="flex: 1; gap: 2em; margin-top: 3em; margin-bottom: 3em; ..."
          

          I had to look up what these do, so they might not be precisely correct translations, but hopefully, you get the idea. It’s mostly like using inline styles, and like not using classes.

          In some scenarios, these frameworks might simplify certain things, like how my applies two CSS rules. And they reduce the visual clutter of inline styling somewhat.

          But overall, it feels like people are dissatisfied with semantic classes, but don’t want to lead the discussion for using inline styles, so they grab these CSS frameworks to pretend that they’re not using inline styles.

          It is fundamentally a difficult discussion to lead, because inline styles feel great, while you’re writing them. They’re less great for maintenance.
          But semantic classes definitely have long-term problems, too.

        • Blackmist@feddit.uk
          link
          fedilink
          English
          arrow-up
          5
          ·
          4 months ago

          Could argue here that you’re still writing CSS, just cross compiling to it from Bootstrap shortcuts.

    • smooth_tea@lemmy.world
      link
      fedilink
      arrow-up
      4
      arrow-down
      1
      ·
      4 months ago

      “Figured it was a bad idea” actually means that some people were against it because they believed semantic class names were the solution, I was one of them. This was purely ideological, it wasn’t based on practical experience because everyone knew maintaining CSS was a removed. Heck, starting a new project with the semantic CSS approach was a removed because if you didn’t spend 2 months planning ahead you’d end up with soup that was turning sour before it ever left the stove.

      Bootstrap and the likes were born out of the issues the semantic approach had, and their success and numbers are a testimony to how real the issue was, and I say this as someone who never used and despised bootstrap. Maintaining semantic CSS was hard, starting was hard, the only thing that approach had going for it was this idea that you were using CSS the way it was meant to be used, it had nothing to do with the practicality. Sure, your html becomes prettier to look at, but what good is that when your clean html is just hiding the monstrosity of your CSS file? Your clean html was supposed to be beneficial to the developer experience, but it never succeeded in doing that.

      • Aux@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        4 months ago

        There’s nothing hard about semantic naming. Especially when you’re separating your elements into components and use SCSS or some other pre-processor.

        • smooth_tea@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          4 months ago

          Either you understand that the consensus is that naming things is hard and you just want to elevate yourself above everyone else by arguing against it, or you’re unaware that it is the consensus, in which case your opinion doesn’t really matter because you most likely underestimate the issue.

          It’s such a truism that I’d suggest googling "naming things is hard*.

          There are only two hard things in Computer Science: cache invalidation and naming things. – Phil Karlton

          https://www.namingthings.co/