this post was submitted on 22 Dec 2025
283 points (96.1% liked)

Programmer Humor

28076 readers
733 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
 
top 50 comments
sorted by: hot top controversial new old
[–] tiredofsametab@fedia.io 64 points 6 days ago

<CENTER><DIV>just as the founders intended</DIV></CENTER>

/ If your language has 58 ways to accomplish something like that, you're in for a bad time.

[–] hperrin@lemmy.ca 36 points 6 days ago (2 children)

Centering a div is pretty fucking easy nowadays. What’s way harder is aligning a god damned SVG icon with text.

[–] YoSoySnekBoi@kbin.earth 13 points 6 days ago (4 children)

Even that is pretty easy nowadays with modern CSS:

<div> <svg /> Text </div>
div {
    display: flex;
    align-items: center;

    /* If the SVG needs an offset */
    & svg {
        --offset: ...px, ...px;
        transform: translate(var(--offset));
    }
}
[–] onlinepersona@programming.dev 14 points 6 days ago (1 children)

Yeah. Easy. So easy. Text size changes, svg not centered anymore. Add margin (or whatever that inside margin is called), and tada, not centered.

[–] funkless_eck@sh.itjust.works 16 points 6 days ago (2 children)

padding

At the risk of getting flamed - I wonder if because CSS is a design tool not a programming tool, it will seem unintuitive to people from a technical background, but more intuitive to people from a design/arts background

[–] TrickDacy@lemmy.world 10 points 6 days ago* (last edited 6 days ago) (1 children)

Exactly this ^

When we had "backend" people at my shop, they were god awful at css. It was so bad at one point that I scolded any backend person who touched css because they always fucked shit up if they did.

[–] Phunter@lemmy.zip 14 points 6 days ago (1 children)

I fuck up CSS on purpose whenever possible to reduce the likelihood of anyone letting me near it.

[–] TrickDacy@lemmy.world 7 points 6 days ago

Maybe you used to work with me? haha

[–] onlinepersona@programming.dev 8 points 6 days ago

I think you're right. CSS was more understandable to me after reading that it came from the world of print media. It's how things were laid out there and it was transformed into a language from those with domain knowledge.

But I would be curious if those who studied art also use the same terminology. If so, then it would make sense that it would seem more intuitive to them.

load more comments (3 replies)
[–] The_Decryptor@aussie.zone 2 points 4 days ago (1 children)
<p><svg class="icon">...</svg> Text</p>
p .icon {
    --size: 1.25em;
    vertical-align: calc(0.5cap - 0.5 * var(--size));
    height: var(--size);
    width: var(--size);
}

Done.

[–] hperrin@lemmy.ca 3 points 4 days ago (1 children)
  • Doesn’t work with non-square icons.
  • Doesn’t align with multi-line text (text wraps to underneath icon).
  • Only aligns centered (no baseline).

But that’s pretty good for most cases.

[–] The_Decryptor@aussie.zone 2 points 4 days ago

Ahh, yeah that's a bit harder, CSS multiline stuff is pretty flaky from what I can recall. You need to drop down to block layout, e.g. making the containing element a flex parent (Better term than that?) and then making the icon centered within that can work, but then we're back to square one with sizing the icon.

[–] TrickDacy@lemmy.world 25 points 6 days ago (4 children)

Do people who talk this kind of shit about css really not understand they're just admitting they're not good at css?

[–] cbazero@programming.dev 19 points 6 days ago (2 children)

If you need to be good at a layout language to center something, then maybe the layout language sucks.

[–] TrickDacy@lemmy.world 9 points 6 days ago

What it says is zero knowledge on the part of the whiner.

[–] irelephant@programming.dev 4 points 5 days ago (2 children)

You literally just have to give it a width and add margin: 0 auto;

[–] humorlessrepost@lemmy.world 3 points 4 days ago* (last edited 4 days ago)

I think it’s implied they’re talking about centering both horizontally and vertically. And probably with unknown height.

Still easy these days , though.

[–] Witchfire@lemmy.world 2 points 4 days ago* (last edited 4 days ago) (1 children)

Or use Flexbox

But your solution works as well for simple cases

[–] irelephant@programming.dev 1 points 3 days ago

I generally avoid flex for simple stuff (i like weird browsers), but for more complex layouts it should certainly be used.

[–] Whelks_chance@lemmy.world 16 points 6 days ago (1 children)

If it were designed properly you wouldn't need to be good at it, it would be trivial and obvious to do the only thing anyone ever needs to do to their content within an area of the page

[–] TrickDacy@lemmy.world 31 points 6 days ago* (last edited 6 days ago) (2 children)

Good news: centering a div is insanely easy to do and has been for like 15 years.

[–] Windex007@lemmy.world 17 points 6 days ago (1 children)

You probably didn't expect that comment to make me feel so old.

load more comments (1 replies)
[–] GenderNeutralBro@lemmy.sdf.org 4 points 6 days ago (1 children)

The last time I did any html/css work was about 15 years ago. Now I'm curious what's changed.

[–] myotheraccount@lemmy.world 7 points 6 days ago

flex box, grid layout, and a million other things

[–] Witchfire@lemmy.world 3 points 4 days ago* (last edited 4 days ago) (1 children)

Same with people who complain endlessly about JS/TS letting you add a string to an object. I work with this shit daily, these are literally the least of my problems.

[–] TrickDacy@lemmy.world 1 points 4 days ago

Totally agree.

[–] Quibblekrust@thelemmy.club 3 points 5 days ago (11 children)

I'm not good at programming Brainfuck, either.

load more comments (11 replies)
[–] Ensign_Crab@lemmy.world 12 points 5 days ago* (last edited 5 days ago) (1 children)

It's nonintuitive and could have been designed better from the outset, but it's not impossible or even difficult. Now can we fight about something meaningful?

vim and emacs are right there, people.

[–] Jankatarch@lemmy.world 4 points 5 days ago* (last edited 4 days ago) (1 children)

Emacs has a better file-manager and you can setup an extremely great latex-editor.

Also extensions don't randomly not work on bsd as much. There is even evil-mode and no-window option.

The only place vim wins at is that there is an optional and lightweight autcomplete with lsp support you can activate by pressing or in gvim during interactive mode.

And NOBODY uses it.

[–] luciferofastora@feddit.org 5 points 4 days ago

Vim has one critical advantage though:

I learned it first

[–] squirrel@piefed.kobel.fyi 22 points 6 days ago
div {
  display: grid;
  place-items: center;
}
[–] korthrun@lemmy.sdf.org 14 points 6 days ago

Lol, easier to write an article theorizing the ways it can be done than to just show him a centered div.

[–] eskuero@lemmy.fromshado.ws 12 points 6 days ago

<center></center>

I only know how to stick it in a cell in a table and center the cell.

Never learned css, a bit left behind now hehe.

load more comments
view more: next ›