140
Average CSS (lemm.ee)
submitted 2 months ago by [email protected] to c/[email protected]

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

top 50 comments
sorted by: hot top controversial new old
[-] [email protected] 23 points 2 months ago

The author should be killed for indentation alone.

[-] [email protected] 5 points 2 months ago* (last edited 2 months ago)

I know, right? Needs more tab.

load more comments (1 replies)
[-] [email protected] 17 points 2 months ago

Client: "Can you switch these two colours, you have 1 minute to fix it or you're fired!"

Result:

load more comments (1 replies)
[-] [email protected] 11 points 2 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...

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

I know! What a mistake of a framework. Glad my colleagues drummed it out of me.

load more comments (1 replies)
[-] [email protected] 5 points 2 months ago

Aren't classes in CSS supposed to represent visual styles? What else could they be for?

[-] [email protected] 15 points 2 months ago

Pretty sure they're referring to class names describing the visual style being applied, rather than what that class represents semantically.

E.g. .red-bold vs. .error-text

[-] [email protected] 4 points 2 months ago

Oh, that makes sense.

[-] [email protected] 3 points 2 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 bitch. Heck, starting a new project with the semantic CSS approach was a bitch 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.

[-] [email protected] 2 points 2 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...

load more comments (3 replies)
[-] [email protected] 11 points 2 months ago
color: lime !important;
z-index: 1000000;

[-] [email protected] 10 points 2 months ago

I love the superstitious z-index just in case it does something to help.

[-] [email protected] 3 points 2 months ago

At least that's actually easy and quick to do and is the only way of doing it. Centering a div however has 81639393 ways and it seems the one that works is different every time

[-] [email protected] 9 points 2 months ago

Bro its so easy bro, just use flexboxgridcolumns its been a standard since 2010 just flex it bro you haven't learned to flex yet just check w3c schools and add a flex you can polyfill it but don't use that hacked one use the good flexpolyfill then { content-align-middle-child-elements: center-middle-true-neutral } so easy with flex bro

[-] [email protected] 3 points 2 months ago

I know you meant this sarcastically, but yes, flex is a good option for centering something. Either that or setting the left and right margins of the element to auto, which is generally even easier.

Basically, if you're in a flex container use flex, if you're in a grid use grid, and if neither of those apply set the left and right margins to auto.

[-] [email protected] 1 points 2 months ago

Also seriously, anybody having problems with flexbox should try this:

https://flexboxfroggy.com/

I'm not sure there's any version of it for grids, but IMO grids are inherently more intuitive, so it may not be needed. Flexbox is the one that is hard to learn.

[-] [email protected] 3 points 2 months ago

Well, flexbox and grid have different purposes in my opinion/experience. Personally I use grid for "top level" layouts like the layout of the whole site, while I tend to prefer flexbox for layouts inside the grid. Of course that's just a rule of thumb, there are absolutely cases where this isn't the best option.

[-] [email protected] 1 points 2 months ago
load more comments (8 replies)
[-] [email protected] 8 points 2 months ago

Well, that's what you get for using classes like "white" and "lime".

[-] [email protected] 2 points 2 months ago

Exactly this. Bootstrap killed the css star.

[-] [email protected] 4 points 2 months ago

People learning CSS through shitty frameworks:

[-] [email protected] 3 points 2 months ago

I am very, very surprised about the competence of the commenters here. I have had many discussions on reddit about the advantages of meaningful instead of presentational class-naming and you're normally met with great resistance, especially with users of frameworks like Bootstrap and Tailwind.

Here, everyone seems to either 'get it' or is willing to hear why classes like .lime are bad. Very cool.

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

People that advocate for presentation naming haven't endured a major company rebrand.

load more comments (1 replies)
load more comments (4 replies)
[-] [email protected] 3 points 2 months ago

No! I wanted orange!

[-] [email protected] 2 points 2 months ago

Not allowed to credit the site in your text editor?

Is the owner in the room with you now?

[-] [email protected] 1 points 2 months ago

This screenshot is not mine, it was sent to me via Matrix

[-] [email protected] 6 points 2 months ago

You get used to it. I don't even see the code

[-] [email protected] 3 points 2 months ago

Do you have a built-in browser in your brain that renders it?

[-] [email protected] 6 points 2 months ago

All I see is blonde, brunette, redhead. Hey uh, you want a drink?

[-] [email protected] 2 points 2 months ago
[-] [email protected] 3 points 2 months ago

It's good for two things: De-greasing engines and killing brain cells.

[-] [email protected] 2 points 2 months ago
[-] [email protected] 2 points 2 months ago

It's only now that I realise that I understood that reference so late

[-] [email protected] 3 points 2 months ago

Took ya a bit Keanu, but you got there.

load more comments (1 replies)
[-] [email protected] 2 points 2 months ago

I hate all webdev beyond using raw HTML, CSS and Javascript to make your own crappy website

load more comments (1 replies)
[-] [email protected] 2 points 2 months ago
[-] [email protected] 3 points 2 months ago

Yeah, userstyles are wild. You learn so many ways how to not use CSS. Everything is !important and rather than adjusting the HTML to change the structure, you get to do it all in CSS. 🫠

[-] [email protected] 2 points 2 months ago

flex-direction:row-reverse; my beloved

[-] [email protected] 1 points 2 months ago

At first I only noticed the indent. Wtf

load more comments
view more: next ›
this post was submitted on 07 Jul 2024
140 points (97.9% liked)

Programmer Humor

19166 readers
625 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