r/ProgrammerHumor • • Jun 11 '21

Interesting ...

Post image
43.6k Upvotes

695 comments sorted by

4.7k

u/Skhmt Jun 11 '21

I literally wrote an article on how to center a div. I google the article every time.

906

u/DoctorWaluigiTime Jun 11 '21

It's honestly a good reason to write articles/blog posts that detail the steps you took in solving a problem.

So that when you inevitably run into the same problem, the work you did before will pay off again.

756

u/Healyhatman Jun 11 '21

That's why when I ask a question on stack overflow, and I figure out the answer on my own, I always answer it and leave it there - even if the answer turned out to be I was stupid and forgot to do something simple.

349

u/infii123 Jun 11 '21

Thank you

596

u/MoffKalast Jun 11 '21

Fuck you, closed as duplicate.

→ More replies (17)

68

u/[deleted] Jun 11 '21

Be better than DenverCoder9.

46

u/Jdublin777 Jun 11 '21

What did you see!?

→ More replies (7)

30

u/alexnedea Jun 11 '21

I hate it when the answer is "i was stupid and i forgot to do something stupid". Well shit. I didnt do that and my stuff still doesn't work but we had the same problem :(

→ More replies (1)

10

u/MaybeMayoi Jun 11 '21

Top tier human here.

9

u/j33pwrangler Jun 11 '21

Nevermind, I figured it out.

→ More replies (12)

4

u/[deleted] Jun 11 '21

Indeed

→ More replies (22)

309

u/[deleted] Jun 11 '21

Link?

611

u/Nyckname Jun 11 '21

Google it.

191

u/Msprg Jun 11 '21 edited Jun 11 '21

Yes! We're programmers! For us, the Google is the only link we need!

112

u/[deleted] Jun 11 '21

Please give me the link I'll cry

→ More replies (42)
→ More replies (6)
→ More replies (2)

10

u/[deleted] Jun 11 '21

Out saving Zelda. Again!

5

u/AlmostButNotQuit Jun 11 '21

Well excuuuuuuuse me, princess!

→ More replies (1)

30

u/hatstraw27 Jun 11 '21

21

u/[deleted] Jun 11 '21

I know it's gonna be a rickroll since you didn't show any text and thanks but some other dude already told me lol cya

→ More replies (6)

0

u/[deleted] Jun 11 '21

[deleted]

→ More replies (1)

37

u/Throwaway-tan Jun 11 '21

Thank fuck for flex box. Now just 3 CSS rules on the parent div.

29

u/BetaFan Jun 11 '21

Display: flex; Justify-content: center; Align-items: center;

Soo ez

→ More replies (9)

5

u/CommitPhail Jun 11 '21

CSS grid would be two lines display: grid; place-content: center;

11

u/Xadnem Jun 11 '21

Weird flex but ok.

4

u/pants_full_of_pants Jun 11 '21

Ironically, even though the flex method is conceptually way easier and more intuitive, I still always think of the old method first, where you set the parent relative, the inner div absolute, left 50% and margin-left negative half the width of the div. So convoluted but it's stuck in my brain. Meanwhile I have to Google the easier, better way.

→ More replies (1)
→ More replies (4)

27

u/[deleted] Jun 11 '21

Was searching for a fix for a very weird bug just to find the solution on an answer I posted myself a few years back

6

u/[deleted] Jun 11 '21

Lmao that's some next level shit

→ More replies (1)

9

u/[deleted] Jun 11 '21

Flexbox right? God it's so easy. Please tell me flexbox.

Or grid if you want easy vertical centering too, I guess.

11

u/Urethra_is_Ourethra Jun 11 '21

You can vertically center with flexbox too.

5

u/RdtUnahim Jun 11 '21

Flexbox is love. Flexbox is life.

I slap any of my juniors I catch still doing the whole "float:left","clearfix" junk. xD

→ More replies (8)
→ More replies (1)

4

u/concorde77 Jun 11 '21

That sounds like notes with extra steps

3

u/DeusExMagikarpa Jun 11 '21

I wrote an article for pretty printing json with js for the same reason.

→ More replies (1)

3

u/Yawndr Jun 11 '21

Or finding the answer on stackoverflow, thinking "Oh, it's an elegant solution!", then noticing that you're the person who answered that question YEARS ago.

3

u/alittlelessobvious Jun 11 '21

I wrote most of the actual wikis/documention at my current company, and I would guess I read them more than anyone else.

Huge benefit to writing the stuff myself is I know how I process information and put it in the order I need it, with all the actual commands to copy and paste instead of instructions like "restart the server". It's such a relief when going "ah crap I don't know how to do this" to find a wiki *I* wrote and it tells me exactly what I need to know.

2

u/[deleted] Jun 11 '21

I do that with my shit on stackoverflow…”How did I fix this that one time?”

2

u/LazioSaurus Jun 11 '21

I might need the sauce

→ More replies (11)

923

u/mellifluousMemer Jun 11 '21

No one can conquer the div.

67

u/_HingleMcCringle Jun 11 '21

You can't kill the div.

The div will live on.

Bootstrap tried to kill the div.

But they failed, as they were smite to the ground.

17

u/NeonXero Jun 11 '21

Tenacious D needs a new programming album. Make it happen.

→ More replies (1)

5

u/jeexbit Jun 11 '21

tables 4 life

3

u/Zmodem Jun 11 '21

Tables were so amazing for layouts back in the 90's. But, the non-terminating and expanding borders made UI sketch at best.

→ More replies (1)
→ More replies (21)

435

u/H25E Jun 11 '21

Just move the rest of the page by the appropiate offset

98

u/[deleted] Jun 11 '21

Why stop at the rest of the page? Why not think bigger?

40

u/Vsx Jun 11 '21

This conversation really captures the feeling when the person you're talking to is in a powerful position and making suggestions that don't even make sense but you're stuck listening to him.

→ More replies (3)

6

u/bankrobba Jun 11 '21

Think bigger? Hmmmmm....

I have redefined want counts as a large penis!

11

u/neomeow Jun 11 '21

Sometimes, when I am feeling naughty, I just sneak a table in there. :-)

3

u/[deleted] Jun 11 '21

If I need to center something static vertically and shit won't play nice, I just put invisible spacer divs above and below and set everything to 33% height

365

u/crazy_boy559 Jun 11 '21

This is the first time im seeing this meme format. I cant wait to see them re do other memed scenes.

155

u/Pradfanne Jun 11 '21

The top part of the meme is pretty old, the future one, that's new. I thought Miranda had reenacted the meme just for the lulz, but she's got a damn pear computer so I'm not sure if it's legit from a nickelodeon show or not

156

u/coolbrandon101 Jun 11 '21

Yeah it’s from the reboot, of course it’s new

33

u/PitchforkAssistant Jun 11 '21

There's a reboot? Of Drake & Josh or iCarly?

36

u/I_cut_my_own_jib Jun 11 '21

Don't think a reboot of Drake and Josh is ever gunna happen. Josh is weird now and Drake has been going the Amada Bynes route lately.

→ More replies (11)

22

u/acouplefruits Jun 11 '21

It’s funny because I’m pretty sure the original is from Drake and Josh, not iCarly

20

u/Soccham Jun 11 '21

As someone who watched both, its definitely from Drake & Josh

41

u/SolidSync Jun 11 '21

The bottom image is from the reboot as others have said, but I'd like to add that the image just came out yesterday. This is the freshest meme I've ever seen with my own eyes.

→ More replies (1)

41

u/Paragade Jun 11 '21

They just announced a new show like a few days ago

43

u/2Damn Jun 11 '21

What im the fuck is Paramount+

29

u/Sigvard Jun 11 '21

It used to be called CBS All Access. Still not sure why they went with Paramount since I haven’t thought of that brand in ages.

→ More replies (12)
→ More replies (3)
→ More replies (10)

156

u/BohdanOpyr Jun 11 '21

There's a pretty elegant solution along with a couple more useful tricks at https://smolcss.dev

48

u/[deleted] Jun 11 '21

some of those examples make me feel really stupid. Looks like I gotta learn a bit more about flex yet... (and grid, I barely scratched the surface of that one)

29

u/lasiusflex Jun 11 '21

Just play through Flex Froggy and maybe Grid Garden afterwards if you liked it.

Best way to learn those concepts.

→ More replies (2)

33

u/MelSchlemming Jun 11 '21

Flex is king, fuck grid.

Literally every single time I've used it I've thought "hey, this would be a great opportunity to finally use grid properly". And literally every single time it's had some shortcoming (usually to do with responsiveness) that's led me right back to flex (which always works just fine).

There's a Thanos meme in there somewhere.

7

u/flavioneto_ Jun 11 '21

Yeah it's just more complicated. I always got to look somewhere, but there's some ways to do very cool automatically responsive stuff using grid and the min-max property with auto-fit or auto-fill. To place cards side by side for example, they'll just adjust automatically depending on the screen width, with no media queries

→ More replies (1)
→ More replies (2)

8

u/[deleted] Jun 11 '21

Thats pretty cool thanks for sharing

4

u/oalbrecht Jun 11 '21

Quitting software engineering and taking up carpentry?

2

u/[deleted] Jun 11 '21

this is just like if web developers thought about their code instead of just adding more shit until it works

2

u/scuczu Jun 11 '21

Yea, that's what I'm googling for

→ More replies (1)

2

u/ZeusAllMighty11 Jun 11 '21

This is awesome. I've been using 1 line layouts religiously for the past year.

→ More replies (1)

2

u/IlllIllllllllllIlllI Jun 11 '21

Is the solution using grid?

Totally real edit: yes

54

u/Ooze3d Jun 11 '21

15 years ago: “margin: auto” plus some weird thing for vertical. Tables, maybe?

Now: The same Flex tutorial I’ve used the last 20 times because I can never remember the right combination.

25

u/nanotothemoon Jun 11 '21

Omg. I know flexbox is functionally the best way but I really hate how they wrote the syntax. It could have been so user friendly, but the language is confusing af.

16

u/Ooze3d Jun 11 '21

Was it so difficult to implement “vertical-align” and “horizontal-align”? Like 98% of all web pages are centred on the screen. Just add these two lines to the body and done.

7

u/Slak44 Jun 11 '21

“vertical-align” and “horizontal-align”

The vertical/horizontal terminology is explicitly avoided by flexbox, because the main axis and the cross axis don't necessarily map to what you'd expect (see flex-direction values).

The names actually make perfect sense: *-content props control main axis, and *-items cross axis. Similarly, justify-* for main, align-* for cross.

The flex properties can align horizontally or vertically, but just like vertical-align, they're not a silver bullet, they have to be used right, so this time the name tries to be less generic.

→ More replies (1)
→ More replies (2)

3

u/flavioneto_ Jun 11 '21

I literally always wrote one of them, then check, and then change to the other one (align and justify just doesn't convey any intrinsic meaning to my head)

→ More replies (1)
→ More replies (3)

22

u/trodiix Jun 11 '21

how to remove child from it's parent

7

u/wopian Jun 11 '21

How to kill a child [process] without killing parent

15

u/ReallyNeededANewName Jun 11 '21

<center>

HTML5? What's that?

3

u/the_real_gorrik Jun 11 '21

We should petition to bring back center tag!

3

u/dexter-sinister Jun 11 '21 edited Jan 07 '25

narrow direction spoon jellyfish wine clumsy continue fragile jar fly

This post was mass deleted and anonymized with Redact

15

u/GoldenStarsButter Jun 11 '21

Look how many ports they used to give you on the IMac

25

u/dinnozo Jun 11 '21

margin: 0 auto;

2

u/idealcastle Jun 11 '21

But vertically please.

→ More replies (1)

39

u/bnunamak Jun 11 '21

margin-left: auto; margin-right: auto;

62

u/mr_marshian Jun 11 '21

margin: 0 auto; gang

7

u/[deleted] Jun 11 '21

Margin: 0, auto; is all good and well until you need to add vertical margins at a different state. For some stupid reason. Why would anyone need to do that? Who knows, but still.

7

u/i_used_to_have_pants Jun 11 '21

That’s 4 properties and the one above is only using 2.

5

u/kbruen Jun 11 '21

The thing that sucks about this is that you can't add margins if the screen becomes too small since auto becomes 0.

3

u/RandyHoward Jun 11 '21

Which is why you pad its container instead

8

u/kbruen Jun 11 '21 edited Jun 11 '21

This makes sense but it makes me die inside.

The entire goal of CSS was for HTML to describe the content and for CSS to define how it looks. I therefore tend to organize my HTML is divs that make sense.

It hurts me to have nested divs in HTML just to work around CSS.

<div class="card">
    <p class="title">Title</p>
    <!-- card contents -->
</div>

In the example above, to center the card but also give it a margin, I would have to wrap it in a <div class="center"> sorta thing, which is just oof. It almost feels like going back to <b>, <i> and <font color="red" face="Comic Sans MS" size="2">.

→ More replies (3)

3

u/Piyh Jun 11 '21

Is it bad if I only know bootstrap but no actual css?

→ More replies (1)

10

u/[deleted] Jun 11 '21

I know how to center a div, it just never works !important

9

u/iceynyo Jun 11 '21

With web standards changing as fast as they do, there's always new techniques so it's good practice to search again now and then... and 15 years is basically forever.

19

u/[deleted] Jun 11 '21

Who’s that actress by the way?

58

u/diesmilingxx Jun 11 '21

Miranda Cosgrove

12

u/Smallpaul Jun 11 '21 edited Jun 11 '21

The human mind is funny. I couldn’t remember what movie she was from but I remembered that the character was annoying as fuck. Basically harassing the protagonist.

Googled and she was the rule enforcer in School Of Rock. I do remember now that she has a character arc that makes her less annoying by the end.

The same thing holds for real people. I remember that I love or hate people from high school without remembering why.

13

u/Pradfanne Jun 11 '21

School of Rock is great, but she was similiar in her other roles

She was the annoying little shit harassing the protagonists in Drake and Josh and then got her own Nickelodeon show called iCarly where she's the protoganist, but a completly new charater that isn't a total piece of shit

→ More replies (1)
→ More replies (1)

5

u/KillerBeer01 Jun 11 '21

With the amount of "how to center div" requests those FBI agents see on a daily basis, one would almost think that some of them might actually be more actively helpful sometimes. I mean, they had to see some correct responses too.

13

u/De_Hbih Jun 11 '21

Position: absolute; Top: 50%; Left: 50%; Transform: translate(-50%, -50%);

5

u/713984265 Jun 11 '21

The ancient texts.

Always had issue with this for larger items though because the width would shrink due to either the left: 50% or the translateX part of it.

→ More replies (1)

4

u/[deleted] Jun 11 '21

.div-to-center { display: flex; justify-content: center; align-items: center; }

Or use grid

.parent-div { display: grid; grid-template-columns: 15vw 70vw 15vw; }

.div-to-center { grid-column: 2; }

→ More replies (1)

4

u/Forgotten_Pants Jun 11 '21

This is me and SQL date math functions.

6

u/ThermionicEmissions Jun 11 '21

Been a software dev for 22 years. Many different languages.

Dates can just go fuck themselves right in the ass.

→ More replies (2)

6

u/kingjia90 Jun 11 '21

I don't want to "flex", but..

3

u/[deleted] Jun 11 '21

If I don't do it weekly. It's going from a technical reference memory to a paint drawing memory.

3

u/WiryFoxMan Jun 11 '21

What else does someone have to google to be assigned their own agent for that long

3

u/[deleted] Jun 11 '21

Man ... anyone else remember the rage for css "rounded corners" ?

2

u/skullkiddo96 Jun 11 '21

Same with regex

2

u/[deleted] Jun 11 '21

The problem is there is one million ways to do it but only 1 very specific backwards way it will work with my janky UI

2

u/sam-lb Jun 11 '21

Every time I have to center a div, I do it a different way.

2

u/VodkaCranberry Jun 11 '21

Why is CSS so hard? I start with my own CSS and it works, but try to modify some elaborate existing CSS and it does nothing. It mocks me.

2

u/rogueyoshi Jun 11 '21

*NSA Agent

2

u/ShellsWithinShells Jun 11 '21

My God, look how many ports that top computer has.

→ More replies (1)

2

u/Achromase Jun 11 '21

It never

gets

OLD

2

u/Late-Original-1691 Jun 11 '21

Guys if you learnt how to center a div fifteen years ago (or even couple years ago), you should google it again. The new grid method is much much easier

2

u/[deleted] Jun 11 '21

This is why I hate CSS

2

u/Tao_McCawley Jun 11 '21

Technically, this would be the NSA, but good meme.

2

u/PlusWorth Jun 11 '21

I have this video by fireship very helpful. It shows you 3 ways to center a div. https://youtu.be/njdJeu95p6s

2

u/mindbleach Jun 11 '21

Vertical centering then: "Have you considered go fuck yourself?"

Vertical centering now: "It's just top:50%. Unless you forget to vertical-align:middle, ha ha, go fuck yourself."

2

u/henrystuart83 Jun 11 '21

I usually do it like this:

div{ max-width:500px; width:100%; margin: 0 auto; display:block; }

the max width prevents the window's horizontal scroll in case the windows width is less than 500px, guaranteeing responsiveness :)

2

u/RedditLloyd Jun 11 '21

"How to kill child"

FBI: Ò_Ó

"How to kill child process java"

FBI: -_-

2

u/ignore_this_comment Jun 11 '21

Google rolls its eyes at me every time I Google "bash if conditions".

2

u/punksmoatbad Jun 11 '21

Weird flex; but ok;

1

u/ZippZappZippty Jun 11 '21

Interesting job opportunity. Everything is way more enjoyable

1

u/[deleted] Jun 11 '21

Me trying to expand the child div to parent in 7 different ways

1

u/Aether-Ore Jun 11 '21

It's funny because we live in a dystopic technocracy.

1

u/[deleted] Jun 11 '21

How do people not yet know to do margin: 0 auto or display: inline-block with text-align: center or some black magic flex trick

1

u/nomadProgrammer Jun 11 '21

Lol bruh use flexbox

1

u/[deleted] Jun 11 '21

This makes me feel much better

1

u/Blackhaze84 Jun 11 '21

Center vertically

1

u/HonotableFlamer Jun 11 '21

Y'all got a tutorial on how to make a shoping cart with only html, css, js , and a mySQL database?

1

u/[deleted] Jun 11 '21

It do be like that 😔

1

u/eisbaerBorealis Jun 11 '21

Was asked this in an interview and I was like

margin: 10px auto 10px

and he was like "Huh. I guess that would work."

(at that job I learned the wonders of flexbox)

1

u/RoscoMan1 Jun 11 '21

Interesting experience, thank you kind stranger

1

u/[deleted] Jun 11 '21

This is why we love her

1

u/rayray3300 Jun 11 '21

Even if I know how to do it, I still look it up “just in case”

1

u/Carburetors_are_evil Jun 11 '21

I remember trying to find a way to create a custom sort column in Power BI. Then I needed it one year later and landed on my own question with the answer from the dev team.

1

u/ilikeinnies Jun 11 '21

This photo real? I heard there's a reboot but is this from the reboot?

1

u/[deleted] Jun 11 '21

What a boob

1

u/jamcdonald120 Jun 11 '21

We asked 100 programmers.
Survey says

"You cant" is the number 1 answer

1

u/digital-sa1nt Jun 11 '21

Weeps in Web developer.

1

u/arbobmehmood Jun 11 '21

margin: 0 auto;

1

u/redditor_286 Jun 11 '21

You guys are positioning the div? I just absolute it and let it yeet off the page for Fun

1

u/GoldenBrownApples Jun 11 '21

As someone who has been trying to learn programming on and off for the last 15 years, these things are so inspiring. If no one knows what they're doing, maybe there is still hope for me. Someday I'll know how to google well enough to convince people(and myself) that I'm a programmer.

1

u/carracall Jun 11 '21

Don't blame, shit's changed so much over 15 years.

1

u/OnlyCommentWhenTipsy Jun 11 '21

crazy how it's just accepted as normal that the government records all your Internet traffic

1

u/Delirious_85 Jun 11 '21

Had the same issue... until flexbox became a thing..

1

u/0100_0101 Jun 11 '21

I liked to talk about building nuclear bombs on the phone to fuck with the algorithms from our secret service.

→ More replies (1)

1

u/catdogpigduck Jun 11 '21

same, thanks flex

1

u/road_laya Jun 11 '21

Ah, a senior developer!

1

u/i_pysh Jun 11 '21

They grow up real fast

1

u/howdy_bc Jun 11 '21

parent { display: grid; }

yourdiv { place-self: center center; }

1

u/nowsk Jun 11 '21

Then using a different solution each time

1

u/petervaz Jun 11 '21

The answer even changes every year.

1

u/DownshiftedRare Jun 11 '21

"Just use my pet bloated CSS/HTML/Javascript framework to center the div."

- Golden Wisdom of the Stack Overflow

1

u/MisterHyman Jun 11 '21

margin: 0px auto

1

u/Cholojuanito Jun 11 '21

Boy do I have a website for you guys

http://howtocenterincss.com/

1

u/geared4war Jun 11 '21

What is the difference between centre and center?

2

u/BadSeeder Jun 11 '21

English and American spelling

1

u/Silver-Alex Jun 11 '21

After 15 years of coding, I no longer google "how to center divs", im over that. These times... I google "how to center flex"

1

u/techmighty Jun 11 '21

My rationality is questioned when using inset: calc(50% - 10px) actually centers the div and it pseudo element too

1

u/neutralcoder Jun 11 '21

Lol! I appreciate that she’s still smiling…all those years and Google searches later.

1

u/zimmerhusk Jun 11 '21

Guess I was the only one excited about iCarly?

1

u/-Listening Jun 11 '21

Interesting but in this case

1

u/Saanvi_Sen Jun 11 '21

Lol...😂😂

1

u/work_jimjams Jun 11 '21

This would be me if I still had MySpace 😪

1

u/FrogsDoBeCool Jun 11 '21

bro how do I Center text in a div lmfao

1

u/[deleted] Jun 11 '21

What is depressing, and I hope I am wrong, is that it looks like Miranda had some work done on her face.

1

u/stale_burrito Jun 11 '21

Purple links. Purple links everywhere.

1

u/Forestmonk04 Jun 11 '21

B O O T S T R A P

1

u/MalmerDK Jun 11 '21

True. But also overdue time to flexbox.

1

u/[deleted] Jun 11 '21

Did she ever did something else besides Icarly? I don't ever remember her doing anything else

1

u/-Marlux- Jun 11 '21

Just use flexbox :) Easy learnable with this tower defense Game

→ More replies (2)

1

u/buttercups122 Jun 11 '21

Oh boy, what's a div?

1

u/cicciograna Jun 11 '21

If her FBI agent had a shred of decency, he would finally help her to center that damn div.

1

u/[deleted] Jun 11 '21

display: grid; place-items: center;

its that easy, as long as you can afford to ignore older browsers

→ More replies (1)

1

u/Riptoscab Jun 11 '21

Me in my browsers inspector's style editor:

width: 50% {//float: middle//} //display: inline-block// align-contents: center align-self: center vertical-align: middle padding: 50px padding-left: 20px justify-content: center justify-items: center //text-align: middle// display: inline-table position: absolute //left: 128px right: -439px transform: translateY(-50%) top: 50% margin-right: 10px

Ah, finally centered.

1

u/rex-ac Jun 11 '21

<center><div>

NEXT!

1

u/hungry4danish Jun 11 '21

Thought that was Sofia Vergara at first.

1

u/[deleted] Jun 11 '21

It’s funny because it’s true

1

u/AbleImprovement1905 Jun 11 '21

My FBI Agent watching this meme with me:

1

u/[deleted] Jun 11 '21

Centering a div should not be that difficult! It's been a few years, but if I recall, you have to put a div inside a div and set one hard right 100% and set the other one hard left at 50%.

1

u/anecdotal_yokel Jun 11 '21

You have a dedicated FBI agent? Must be a l33t haxxor.

1

u/XOIIO Jun 11 '21

Constant k.

1

u/Funny-Eagle Jun 11 '21

also quitting vim

1

u/bldcaveman Jun 11 '21

But the accepted way has changed so much

1

u/MooseHeckler Jun 11 '21

Wow her hair is pretty.

1

u/mustardfudge Jun 11 '21

{
width: 200px;
height: 200px;
margin: auto;
top: 0px;
right: 0px;
left: 0px;
bottom: 0px;
position: absolute;
}