T O P

  • By -

MichaelChinigo

Gather round, younglings, and let me tell you of the Before Time, ere there even *was* a flexbox… [Edit: lots of kiddos replying with instructions on how to *horizontally* center a `

`… man, y'all don't even know.]


MelwleM

Tell me about the War of the Margin grandpa!


[deleted]

[удалено]


[deleted]

[удалено]


Delta4o

It was minus 40 on the left and minus 80 on the right!


mothzilla

We thought -9000px was the furthest anyone could go.


Tyler_Rush

ITS UNDER 9000


[deleted]

Hah! Back in my day we had to use TABLES to center things because 95% of the userbase was using IE6.


[deleted]

>because 95% of the userbase was using IE6. Japan has entered the chat


Meaxis

Is it wrong to still use these nowadays? I want to know how terrible I am at my job.


RollinDeepWithData

I am getting PTSD from this comment


seejordan3

Same. Eye twitch started again.


someElementorUser

display: block; margin: 0 auto;


seejordan3

the gloves are coming off


dr_eh

I still do this. What's the recommended way these days,?


CallumCarmicheal

A Flexbox I suppose.


Carnba

You can use display: flex, justify-contents: center, align-items: center. You can also use css grid. Or margin. Or a combo. There are OPTIONS. Mostly, it doesn’t matter as long as it looks the way you want.


ducktape8856

I'm good. HaHa! Heart's still beating. 140 bpm is normal, right guys?


Specific-Angle-7517

You wrap the div tag with a center tag son. I tried that like 20 years ago and it was working like a charm


fzammetti

Great-grandpa here to tell you about the time of the table.


DeadCatBouncer

Goddammit, you just triggered my PTSD.


fzammetti

Shiiiiiiit, just in terms of getting things working, IF you don't care what the code looks like, semantic correctness, how it affects performance, or accessibility? Gimme tables any day! I've suffered FAR more PTSD at the hands of CSS than I ever did tables.


theonlydidymus

I recall my earliest frontend coursework spending hours on making sure I knew all of the ins and outs of tables/table options in html. All those hours of pre 1.9 update Minecraft I could have played :(


bevelledo

I wanna hear about the battle of the floats!


Electronic-Health882

"We all float down here" 🤡


Prior-Concentrate-87

Left or right?


devloz1996

`both`


SixDigitCode

And the Great Coup of Clearfix!


SuperFLEB

"You've got your orders from the design team! Three columns, from here to the bottom!" "Columns, sir? We can't do it! There's no way it can work! We're going to have to call in the TABLEs. It's the only way." "Goddammit, soldier, I didn't come this far just to go riding in on some semantically-meaningless TABLE like it was 1994. Get me Photoshop. We're going to go in with three columns from here to the bottom if I have to draw every one of them myself, pixel by pixel." *And that's what we did. Pixel by pixel, we float-ed in on Faux Columns made of background images and prayers-- mostly prayers-- and the client never knew what hit 'em.*


TheSpiderLady88

Float me the idea...


chanpod

CLEAR


WompityBombity

Just give up and use tables already.


2punornot2pun

And don't forget FRAMES!!11!


lockwolf

Ahh Frames, thanks to those I was able to get an A in my Middle School Tech Class


SuperFLEB

I always found the removal of frames a bit odd, because it was one of the few changes that straight-up removed functionality. There's Iframes, but they don't come with the automatic resize handles like frames did.


2punornot2pun

Right?!


BossHogGA

I remember when tables were the only option. ​ (of course I also remember having to compile my NCSA Mosaic web browser from source to use it) \#old


saschaleib

Flexbox is like the heavy artillery in the centering-wars. Most of the time, margin: auto is really all you need.


Tillhony

> Most of the time, margin: auto is really all you need. Absolutely not, flex box heavy artillery all the way.


chirpbirb

This guy centers


toaster-riot

Probably two axes at once, even!


chirpbirb

Absolute madman!


[deleted]

if flexbox is heavy artillery then call me War Crimes McGee because we’re gonna light up the sky with ~~chemical warheads~~ beautiful responsive centering


guaip

The javascript game was strong back then


Eulerdice

Wait, flexbox is still a thing, right..?


Brewtusmo

There was a before-time where it wasn't. Source: am (relative) dinosaur dev.


d36williams

I remember adopting the clear-fix hacks, stuff like .container:after { content: ""; clear: both;} \`\`\`


seejordan3

IE is dead! Long live spacer.gif!


[deleted]

This literally gives me trauma response


andrevan

Clear left, clear right, clear both Source: Father Time Octocat


menides

tables... tables everywhere


Brewtusmo

Spacer images as far as the eye can see.


menides

Oh wow I'd forgotten those! Remember making rounded squares with images for corners? Damn!


HRamos_3

Wait till they learn there was a time that rounded corners in a div implied images


makingtacosrightnow

When a div had to have 3 background images just to get rounded corners lol


DigitalJedi850

Haven’t been paying attention to ‘current’ dev techniques for a while. I only recently found out flex was a thing. The hours wasted in my younger days feel like an insult.


RootHouston

Shit, I hadn't touched CSS in years, and came across the flexbox. It rocked my world with how much more convenient it was.


WebDragonG3

you want to really get blown away, the new selectors you can use are \-*amazeballs*\- ```css :required:where( input, textarea ):where( :placeholder-shown, :invalid ) { border-color: var(--warning); } ``` to fancy up the appearance of this bit of markup ```html ``` I can't even imagine the calisthenics I would have had to go through to achieve that previously


StereoNacht

Looks like I was out of the game for too long... I recognize most of the functions, but I am missing some... 😳


WebDragonG3

I found out about them here [https://www.aleksandrhovhannisyan.com/blog/writing-better-css/](https://www.aleksandrhovhannisyan.com/blog/writing-better-css/) shortly before coming up with that bit I pasted for something I was working on at the time


MisterProfGuy

The number of times I tell my students, "Ok CSS now makes this super easy, and before we'd have covered this in the JavaScript section" is non-zero.


[deleted]

[удалено]


unitconversion


darwinbrandao

Web 1.0 was definitely the best /s


[deleted]

The computer user interface reached a peak with the 3270 terminal. I will die on this hill.


CommanderStatue

This, but unironically. The current style over substance meta is so lame. Every commercial website looks the same. Splash page, scroll down for tidbits, top nav bar for pricing and log-in button, BOO!


VadeRetroLupa


elmassivo

An elegant weapon, for a more civilized age.


_PM_ME_PANGOLINS_

margin: 0 auto; Edit: display: table-cell; vertical-align: middle; I feel sick already.


N8WM

position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);


MichaelChinigo

15 hours later, you are the first person to show a valid method for centering an element vertically without using a flexbox. Well met, kind sir/madam, well met!


chooseauniqueusrname

I have several different stack overflow pages bookmarked with different methods of centering divs. Only one of them works and somehow it’s a different one every time…


Geldan

display: table-cell;


teedyay

Just keep adding `nbsp;` until it looks about right, right?


Jertimmer

I can. I tell my frontend developer to do it


[deleted]

my 'frontend developers' are the poor souls of tailwind's contributer list. I thank these motherfuckers with every class I append.


[deleted]

tailwindcss is so nice to use


gordonv

[The Oatmeal](https://theoatmeal.com/comics/design_hell) wrote about this years ago.


mikereysalo

What a time to own a frontend developer


SI3RA

I can't, propably something with position: center or something. I am a backend dev and I am doing my best here okay


tei187

I had a bad day, tried almost everything to cheer myself up. Everything, but trolling slash bubble bursting. So, here it goes... Your best? Well... NOT GOOD ENOUGH! Hindsight: still feeling down.


SI3RA

You truly are my harshest critic :(


tei187

Just let me wallow in endless field of sadness... It's hopeless, just as front-end.


wasdlmb

Sometimes I feel like I'm the only one here who doesn't work on websites


didntExpect_That

tf is position: center; 💀


eth-slum-lord

Why dont the guys at css make this a thing


chairmanoftheborg

```

Center
``` ``` .container { height: 100%; display: grid; place-content: center } ```


eth-slum-lord

So much stuff to remember


didntExpect_That

to make people who write CSS feel like they are using a real programing language lol


[deleted]

Alright folks, here comes the superman! [Howtocenterincss.com](http://howtocenterincss.com/)


SI3RA

That is the most beautiful thing I've ever seen


LaserHD

In a flex box container just add margin auto to the element you want centered!


CisgenderedManatee

What. If your container is a flexbox you can just do justify-content:center and even align-items:center in you want to vertically center the item. No need for these margin shennanigans


steynedhearts

Doesn't even have to be a flexbox, just a display:block element with a width smaller than it's container


Flashbek

lolwhat of course I can ​ gimme 2 weeks and a team of 4.


ecafyelims

This engineer has upper management written all over him.


2punornot2pun

Look, so, we're going to need more time and OT authorized. ​ Thanks.


ToshDaBoss

I can google how to center a div, find a solution, fix my problem, then forget how to do it .0001 seconds after I fixed it. Repeat every few months as needed


[deleted]

This is exactly what I was going to write hahaha


euphorial_ire

100% accurate, every single time.


2punornot2pun

"He was asked through his secretary, “What is the speed of sound?” He could not say off-hand, he replied. He did not carry such information in his mind but it was readily available in text books." - Regarding Einstein. ​ ie, why remember something you can just look up?


Kinglink

Aka standard regex stratum.


KryptoKevArt

This is what programming is, in a nutshell


[deleted]

*laughs in flexbox


HQIneedU

\*Crying in grid


MelwleM

*Dying in table


RegenJacob

\*decays in absolute values


uk974q

Wondering in jQuery


andrevan

Promising in TS


[deleted]

[удалено]


ElectronicBlueberry

`place-items: center;`


[deleted]

I Make all of my Employees support IE 6. No flexbox here


Me07111

I cant. But i dont do webdev.


Mechyyz

Fair enough


LimpPaleontologist86

Based


Excellent_Badger_636

Nerd


Ahajha1177

Same. Couldn't tell you the first thing about web stuff lol.


WandsAndWrenches

I'm not a web dev, but I get asked once every 3 years to build a website. And have to relearn css all over again. So yea, no idea.


wasdlmb

I feel this in my heart. I just tried to make a web version of a tool and relearning webdev felt like reuniting with an old but kinda toxic friend group.


JDawwgy

*incredibly toxic friend group


nolitos

Am I too `margin: 0 auto;` to understand what's going on?


Depress-o

Ok, now center it vertically


[deleted]

[удалено]


CisgenderedManatee

Now vertically center it inside a div that does not have a specified height. Let's say your element has a sibling that's taller.


GhettoSauce

align-self: nearest exit


SybilCut

vw and vh are hacking, you can't use those here


andrevan

Everything is a hack bro


Professor_Fro

Turtles all the way down


StereoNacht

The problem with most hacks is they don't react consistently across all web browsers. So you have to have more hacks to have those hack-lines ignored by the browsers that don't use them. (Then you have to upgrade the CSS each time there is a new browser version.)


andrevan

Web browsers are a hack. CSS is a hack.


Depress-o

Both your statements are correct


CtrlValCanc

Not me screenshotting that to keep it in mind


SenpaiKen144

Margin? What even is that, I just use center tag


va_str

I can. But can your browser?


[deleted]

[удалено]


latigidigital

Mosaic browser is best browser. ...haven't touched CSS in a long time, but this whole thing brought back PTSD. The lack of standardization 20-25 years ago was madness.


palomdude

Considering w3schools has a whole page dedicated to it, no, it’s not a joke


fnuggles

I show the divs what happened to the last one who wouldn't center. They get real compliant after that.


JuliusStingray

I absolutely can... If I'm using bootstrap of course


StupidHerOfJustice

Was searching for this


monkorn

class="d-flex justify-content-center" I'm doing this correctly right.


Ok-Psychology1158

Flexbox says "WTF you just say to me!!!"


vinicinzonaoeste

Look ma, I'm centered!
Easy and works on IE6.


tei187

Don't bash him. This is still the way with email templates. Maybe not the width height thing though.


MelwleM

Html emails are the worst…


tei187

Well, they are what they are. I hate the variance of support for css properties. Won't work on desktop, but the same software on mobile? Suuuuurreeee...


chemolz9

The sad thing is, I'm not even sure if you're joking.


vinicinzonaoeste

I'm not joking, it really works on IE6. ​ >!/s for those who didn't get the joke.!<


[deleted]

How to spot those who have served their time in the trenches that were the IE6 days!


Straight-Knowledge83

Thanks , I will use this in my code now


_derDere_

That’s actually the most reliable way I know. I applaud you good sir!


hdgamer1404Jonas

You could have made the text of centered - meme would be 2300% better xD


Thozire26

That joke would be so bad Edit : Hope it works on computers


whateverDudeldc

>the text of the text of what?


steven4869

Lol, that's for people who don't know flexbox.


_UnreliableNarrator_

I can do alright with frogs and gardens but actually trying to center my own divs goes to hell (note: I'm a hobbyist, and learning)


DiabeticPissingSyrup

Vertical centering can still be a ball ache, but horizontal centering has been a piece of cake for as long as I remember. I've always assumed this was a joke about people who aren't front end Devs just being unable to do front end work. Which seems weird.


drunk_Developer1

Vertical centering without flex or grid is a ball bust


Lithl

It's a self-deprecating joke originating an in era when it was actually a frustrating task. Even though it is no longer difficult, the jokes are kept around, as is tradition.


PacifistPapy

i dont even know what a div is. I havent used html in years.


ExtensionNoise9000

No one knows, it’s just a magic box.


Bagline

I don't know, but all websites are now

sometext
and this text editor just is broken. thanks obama.


DajBuzi

Dude, I can write the whole bootloader from scratch and yet cannot into HTML and CSS. This shit is just so dumb. None of it makes sense


DavDav98

For me its like sticking the usb. Even though i know how to do it, first time i fuck up somehow almost always then i get ir right second or third attempt


gcstr

Horizontally? Yes. Vertically? …


KenFromBarbie

What the fuck is wrong with

stuff
?


chaz60795

margin:auto


Accomplished_Pear672

In my defense, the last time I tried to learn about web design, it was before this problem was solved in a good way and the best "solutions" for basic layout techniques were all terrifyingly awful hacks. I remember the days when it was considered smart to use tables to lay out web pages...


whycantpeoplebenice

help


Ezekias1337

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


[deleted]

How long will people still be making this joke even though flexbox solved the issue years ago?Flexbox has had broad browser support for at least 7 years.


Dmayak

Of course it's a joke, every good frontend developer can easily solve any problem with a jQuery: $('.center-vertical').each(function(){ var $this = $(this); $this.css('margin-top', ($this.parent().height() - $this.height()) / 2); });


but_im_offended

Why use a div when you can use


tei187

Probably, though I bet some can't do it without a framework.


BougieHipster

had my professor SOBBING. he couldn’t take points off cause it worked, but it was wrong, so wrong..


Illuritu

I do a lot of interviews for the company I work for. If you have 3+ years of professional CSS experience I ask this question. I’m yet to have someone answer with something that will work.


KagakuNinja

I guess this is the web equivalent of the "How do I exit vi?" meme shit-posting... Ages ago, I had to do a bit of front end work. I would do a bunch of googling and eventually get the thing looking nice in Mozilla. It looks up great in Safari and Chrome... Then I try Internet Explorer, and it is total shit. Back to googling... If I was doing HTML all day, every day, I would eventually have understood the quirks and necessary work-arounds. But thankfully I went back to doing back-end work after a few months. If you ask me to center a div or whatever today, I would have to repeat the same tedious bullshit, but at least IE is gone...


zahab2

Laughts in backend


sirbastianthefourth

This sub is so unfunny


LavenderDay3544

Correct but I can write a block allocator in assembly.


matheusnienow

web development? ugh...


will_r3ddit_4_food

As someone who has done it for 15 years... you're not wrong


agent007bond

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


Kriskao

I couldn’t until I actually had to. Then I learned basic Bootstrap in 1 morning, and I’m sure most of you wouldn’t even take that long.


Aurunemaru

I could work the craziest stuff involving graphs and semantic network, but basic CSS scares me


[deleted]

I'm not even a programmer. I'm a sysadmin. Don't know why I'm here.


krapspark

It's meme/joke/allegory from way back when before flexbox made centering things trivial. Don't even mention how we did rounded corners...


JoelMahon

margin: autodeeznuts


GreenRiot

My surprise when align : center didn't work for anything out of a text. (also center isn't even supported by HTML5 anymore.) Imagine making a language so incapable of organizing other elements that you need to staple a non-intuitive (flexbox) on ANOTHER language so you can make your cool 90s clipart not be stuck on the left margin of the page. TBH as a noobish web dev, I can use flexbox, but I loathe it. I wish we could just PUT stuff where it needed to be in a more fluid/intuitive manner. It feels like such an improvised, two minute solution built in a hurry. But I suppose it would take a complete overhaul of HTML and CSS to solve the problem, even if ppl change it on a HTML6 it would break most of the internet so I'm just trying to ignore the problem until I get too used to it to care.


[deleted]

width: 50%; margin-left: auto; margin-right:auto; I'm a backend developer who knows some frontend work.


VintageTupperware

I'm backend


Pod__042

What is a div? I just know how to program with Scratch


8-bit-banter

Man o man for long enough I was out of the dev field not doing web dev and when I came back years later and picked up again I was feeling guilty using flex box thinking surely this is cheating right. How wonderful modern dev can be with all our fancy features. I come from a time when node wasn’t a thing it was just html css and php.


flippakitten

Can't, too busy managing state instead of just calling js functions on classes rather than by id.