this post was submitted on 07 May 2025
1054 points (96.9% liked)

Programmer Humor

23119 readers
1435 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 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] obinice@lemmy.world 42 points 15 hours ago (11 children)

Okay but how do u center a div in 2025

[–] hakunawazo@lemmy.world 1 points 1 hour ago

It's not about the center, it's about the friends we made along the way.

[–] Anomalocaris@lemm.ee 2 points 4 hours ago

maybe the div is already where it's meant to be

[–] WhiskyTangoFoxtrot@lemmy.world 3 points 5 hours ago* (last edited 5 hours ago)

Make your web page in GIMP, export to PNG, <img>.

[–] letsgo@lemm.ee 5 points 7 hours ago

Same way you did it in 2024 but it's easier because the springgirdles have been replaced with rotated manglebrackets.

[–] Blackmist@feddit.uk 9 points 12 hours ago

Depends if you're centering the div or the things in the div. Which has probably been the main issue since CSS was invented.

[–] umbraroze@slrpnk.net 16 points 14 hours ago (3 children)

If using plain CSS, usually it's enough to set width appropriately, and margin-left and margin-right to auto.

If using a Modern Frontend/CSS Framework, then may God have mercy on your poor soul.

(Seriously I just started a new project with TailwindCSS and I'm so confused. But not entirely desperate yet.)

[–] loics2@lemm.ee 3 points 8 hours ago

w-... mx-auto, replace the 3 dots with your desired width value, and that's it with tailwind

[–] Korhaka@sopuli.xyz 11 points 13 hours ago (3 children)

So what is the point of these frameworks if they make it harder?

[–] gradual@lemmings.world 0 points 3 hours ago

I think they exist because of ignorance.

People who don't understand how to do a task will usually choose the wrong tools for that task.

If someone is trying to cover up their lack of knowledge, they will usually make things more complicated than they need to be.

[–] toddestan@lemm.ee 5 points 8 hours ago

Generally I find many these frameworks will make some complicated things simple, but the cost is some things that were once simple are now complicated. They can be great if you just need the things they simplify - or in other words can stick to what they were intended for, but my favorite way of keeping things simple is to avoid using complicated and heavy frameworks.

[–] Ricaz@lemmy.dbzer0.com 13 points 12 hours ago (1 children)

If you spend a lot of time on a single framework, you will transcend and become a sort of frontend diety, growing multiple extra limbs allowing you to type in CSS classes faster than any mere mortal

[–] SaharaMaleikuhm@feddit.org 10 points 12 hours ago (1 children)

Until everyone moves over to the next thing and you start from 0 again. Web dev is a nightmare.

[–] gradual@lemmings.world 0 points 3 hours ago* (last edited 3 hours ago)

What's sad is that web development is only a nightmare so websites can be worse.

I genuinely believe it's part of the concerted effort by the cabal to make us accept a 'new normal.'

They don't want an environment where anyone feels like they can make a website. They want us to believe we need to spend years studying before we can do anything, and even then we can only do what our bosses tell us to.

[–] Ricaz@lemmy.dbzer0.com 2 points 12 hours ago (1 children)

I'm doing a small hobby project (a ladder/ranking system for playing beer sports with my community), and I tried out Tailwind.

I gave up and loaded Bootstrap instead, but I will probably end up just writing all the CSS myself.

Seems so silly to have 15 CSS classes on a single DOM element..

[–] bleistift2@sopuli.xyz 0 points 7 hours ago (1 children)

Who’s saying you’re using the frameworks correctly?

[–] gradual@lemmings.world 0 points 3 hours ago* (last edited 3 hours ago) (2 children)

Shouldn't they be designed in an intuitive manner that makes misuse more difficult than regular use?

Otherwise, why even bother using them? It's like now you need to know all the ins and outs of CSS and a trendy framework that will lock you into their ecosystem.

[–] Ricaz@lemmy.dbzer0.com 2 points 3 hours ago (1 children)

Kidding aside, I think the popular frameworks these days are incredibly well made. Frontend web has always been hell, and if your job is producing functional web GUIs, you can't do it on a large scale without them.

[–] gradual@lemmings.world 0 points 3 hours ago

Based on my own experience developing GUIs, I've reached the conclusion that creating them through code is obsolete.

We should be focusing on developing GUIs to develop GUIs, like Godot, instead of 'frameworks' that make an obsolete method of doing things even more cumbersome and complex.

[–] bleistift2@sopuli.xyz 1 points 3 hours ago

Well, I find bootstrap very intuitive, and I don’t have 15 classes on my elements. That’s why I was asking.

[–] x00z@lemmy.world 5 points 11 hours ago

Ask the browser nicely while using please and thanks.

[–] irelephant@programming.dev 2 points 9 hours ago

What threw me was having to set a width.

[–] impedans@lemmy.world 10 points 15 hours ago* (last edited 15 hours ago) (2 children)

If you define what you mean by centering I'll give you a straight answer.

Vertically? Horizontally? Center the text or the entire box? Compared to the viewport, the parent container or the entire page?

"Centering" isn't as straight forward as you'd think, and what you actually want usually depends on the situation.

[–] Schadrach@lemmy.sdf.org 4 points 7 hours ago

Fuck it, align='center'. That'll center it horizontally relative to some context and if that's not good enough then you should have been more precise in your request.

[–] FooBarrington@lemmy.world 6 points 15 hours ago (1 children)
[–] impedans@lemmy.world 4 points 14 hours ago

Yeah that works if you wanna center a box of content it relative to the parent container, either horizontally or vertically. For other situations we've got different tools

[–] endeavor@sopuli.xyz 9 points 15 hours ago* (last edited 15 hours ago)

While centering div, you add one to 2023.

[–] onion_trial@europe.pub 5 points 15 hours ago

You count half the pixels and put them in a margin-left