this post was submitted on 07 Jul 2024
534 points (97.0% liked)

Programmer Humor

19166 readers
1021 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 

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

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 4 points 2 months ago (1 children)

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...

[–] [email protected] 2 points 2 months ago (2 children)

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”.

[–] [email protected] 6 points 2 months ago* (last edited 2 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.

[–] [email protected] 5 points 2 months ago

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