this post was submitted on 20 Mar 2024
702 points (97.3% liked)

Programmer Humor

19704 readers
121 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
702
CSS (i.imgur.com)
submitted 8 months ago* (last edited 8 months ago) by nullPointer to c/programmer_humor
 

easy to get into trouble for sure.

top 34 comments
sorted by: hot top controversial new old
[–] onlinepersona 60 points 8 months ago (1 children)

flexbox made things so much easier, but still hard. There are just too many rules to keep in your head about display and position and how they affect other attributes. And the box model... wow. margin, border, padding, content, but he attribute is box-sizing and it has border-box and content-box, but not the others.

IINM it was written by people who came from print media (just like HTML) and that stuck.

CC BY-NC-SA 4.0

[–] [email protected] 4 points 8 months ago

Man I remember the days before flexbox and with browser specific bugs. CSS still screws with me but nothing like in the 2000s.

[–] [email protected] 38 points 8 months ago* (last edited 8 months ago) (1 children)

I remember before CSS was released it was supposed to be such a panacea. And then everyone said that CSS 3 was going to fix everything.

And now we are here saying the human created system isn't the problem it is the humans that are the problem.

Semiconductors are the aliens. They are ruling us now.

[–] [email protected] 5 points 8 months ago (1 children)

How do you remember those days and not think things are way better now? CSS can still have weird behavior, but it's nothing compared to doing everything through one off html attributes and trying to position things with float hacks and dealing with browser specific bugs. Despite its problems, as someone who has made websites through every Internet era, things have gotten better and better.

[–] [email protected] 1 points 8 months ago

with CSS grid, and now subgrid (finally, chrome), layout with CSS has never been more pleasant

[–] [email protected] 34 points 8 months ago (4 children)

It's really not, though. This is only true if you're bad at CSS, which basically can be said about anything.

[–] nullPointer 50 points 8 months ago (2 children)

unless you inherit a large base written by someone who is bad at it where their approach seemed to be to write new bad rules in attempt to cover up previous bad rules and so on. we all know how supportive employers are at addressing technical debt. (site redesign cant come soon enough)

[–] [email protected] 32 points 8 months ago (1 children)

Not sure about your particular situation but there’s also the possibility that the bad CSS was good CSS when it was written and over time that got superseded by advancements in both technology and practice.

[–] [email protected] 14 points 8 months ago (1 children)

Or simply different styles and/or skill levels were mixed. I'm currently sifting through a code base that I know for a fact started out goodish, but through multiple team reorgs and lax standards/tight deadlines it devolved into a hot mess. A major contributor being that most of the devs were inexperienced in the framework and just did what they thought was right.

[–] [email protected] 1 points 8 months ago

Even supposedly senior devs often have a "I know best" mentality and when they get their hands on a code base do it their way, with the result that after something went through a couple of hands you have a mess of different coding styles and even different software design choices in the same code base, or in other words, and unmaintainable mess.

[–] [email protected] 3 points 8 months ago

Yes, it's that way if you include bad CSS. What isn't the same as you being bad with it.

[–] MajorHavoc 14 points 8 months ago (2 children)

"it's not that hard" just announces to the world that you haven't tried to do anything hard with it.

[–] [email protected] 6 points 8 months ago

I work with WordPress. It doesn't get much harder than that.

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

What do you consider difficult to do with CSS that wouldn’t also be difficult without it?

[–] [email protected] 9 points 8 months ago (1 children)

As someone that has gone through some of the available online tutorials like freecodecamp, and has no real world experience, especially in a team setting, I think I agree with you. I wouldn't say it's hard, but I do feel it's unnecessarily complicated in some areas. Some naming conventions are unintuitive, the cascading inheritance can get confusing especially with multiple hands working on something, and from my experiences, there's minimal if any effort put into best practices, so everyone does things a little different.

[–] [email protected] 0 points 8 months ago

Pff, just define your own cascade with @layers :)

Best advice I can give: Don't use CSS directly, use a pre-processor like SASS/SCSS. It really helps keeping things sane and somewhat organized.

[–] [email protected] 4 points 8 months ago

As someone who is bad at CSS, I can confirm at least half of your statement. ;p

[–] Draconic_NEO 11 points 8 months ago

Totally agree with this. I was trying to do CSS theming on my personal website on SDF to try and make it look nicer but I gave up and just went without it because it never worked right. It's a crappy website anyway with a lot of problems (doesn't have correct margins so on anything outside specific resolutions it looks wonky).

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

Trying to fix padding on an element that has "pad-left" and "padding" at the same time but you don't realize it

[–] [email protected] 7 points 8 months ago (1 children)

The way to fix a pad-bottom is simple! Just give the next element a negative margin-top!

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

I feel like I've actually done that, but it was only because I had to have the padding or else everything broke

I'm glad I'm not alone 😔

[–] [email protected] 1 points 8 months ago

That's no big deal, just use a linter. It's also pretty obvious what the priority is in the inspector.

[–] [email protected] 6 points 8 months ago

i hate that i understand this

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

Out of the 3 main web languages I use to develop my games (HTML, CSS, and JavaScript), CSS is definitely my least favorite.

HTML is relatively simple and understandable such that bugs rarely get introduced into my HTML code.

JavaScript, while janky and not known for good performance, will work without too much trouble compared to other languages (I'm looking at you, C++). No segfaults, effortless type casting, intuitive syntax, and debugging is fairly easy. Worst part is editing HTML and styles with JavaScript, it just feels clunky, to both the programmer and the CPU.

And then there's CSS. Despite being a language dedicated to making things look pretty, it's just an unintuitive list of properties on HTML classes. So many times it takes way too long to do a simple thing like center text in a div when there is other text that is meant to not be centered. But I guess I'm not using it to its fullest potential, as I recently came across an article that listed many pretty graphics, often animated, that was purely made using CSS.

[–] [email protected] 7 points 8 months ago* (last edited 8 months ago) (1 children)

Me in the late 90s: CSS is not a language!

Today: Holy crap, it's now Turing-complete.

[–] [email protected] 3 points 8 months ago (1 children)

When did CSS become Turing complete?

[–] [email protected] 7 points 8 months ago (1 children)
[–] [email protected] 2 points 8 months ago* (last edited 8 months ago)

Some guy has too much free time if you ask me

I mean it's awesome, but seriously, too much free time...

[–] [email protected] 1 points 8 months ago (1 children)

.. effortless casting could be a negative depending on who ya ask.

[–] [email protected] 1 points 8 months ago

I'm of the opinion that it's a positive. Often I use "string" + number to access HTML elements and it just works. I can even use it to concatenate arrays.

Meanwhile, when I try to debug in C++ with cout statements, half the time it doesn't even do anything even though I use std::to_string().

[–] [email protected] 4 points 8 months ago

Nah, in real CSS, the window would overflow and bring down the whole house.

[–] Hammerheart 3 points 8 months ago

I am struggling with using flex for the first time and holy cow do i feel this

[–] mark 2 points 8 months ago (1 children)

Yeah, because anything that isn't a big new JavaScript framework is just way too complicated

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

Somehow I doubt a lot of these opinions are steeped in the experience of building an HTML layout using tables, transparent gifs and inline width attributes. Shit was wild before CSS.