6
Finally realized I was overcomplicating CSS flexbox for 3 months
I spent like 3 months fighting with flexbox to center stuff on my first project page. Kept adding justify-content and align-items in weird combos, and nothing lined up right. Then I found this old forum post where someone just said "use margin: auto on the child element" and it clicked instantly. I tried it on my nav bar and it worked first try, no extra code. Still feel dumb about all those hours I wasted on something so simple. Has anyone else had a moment where one line of CSS fixed everything?
3 comments
Log in to join the discussion
Log In3 Comments
young.nora15d ago
The margin auto trick really is the hidden cheat code everyone discovers eventually. @the_anthony hit it exactly right that it just snaps everything into place without the trial and error. Once you know it, flexbox feels completely different and way less frustrating.
7
torres.grant15d ago
The margin auto trick saved me so many headache hours it's ridiculous how simple it is.
6
the_anthony15d ago
Right? That margin auto trick is like finding the cheat code for CSS. Suddenly everything just snaps into place without all the trial and error.
4