i was JUST scrolling through some old documentation and it is wild how much harder this used to be. people used to rely on all these
messy workarounds like negative margins and inline-block hacks just to get a single box in the middle of the screen. now we have
display: grid;
and flexbox making everything way smoother. it is still kind of confusing when you are deciding which one to use for a specific layout though. i usually default to flexbox for simple items but i am starting to think grid is better for more complex structures.
>it really depends on the parent container's contextsome developers still try to use
vertical-align: middle for everything which never works like they expect. it feels like we have all these new tools but picking the
most efficient one is still a learning curve. does anyone else find themselves overthinking the choice between flex and grid for simple components? i feel like i spend way too much time deciding on the layout properties when a quick
place-items: center;
would do the trick lmao.
full read:
https://www.joshwcomeau.com/css/center-a-div/