Weird flex, but ok
Hehe.
I see what you did there.
It’s not weird, it’s powerful!
Centering things on a web page is so easy.
I also have to look it up every single time.
Hell, I’m a web dev and I’d pay someone to center things for me
I usually just try justify-content, justify-items, align-content, and align-items. Then when it gets centered I remove the rest.
I’m not paid to remember, I’m paid to know it’s possible.
Same! I usually open the dev console and just flip through all the options until I find the one that does it
<center></center>
That’ll be 200 dollars
Great, now make it blink.
For real. When I have a front-end story to do, I basically just slam on the keyboard until it looks close to how UX wants it.
Co-pilot?
I wish i was that good with html/css
cool flex bro
I wasn’t expecting this to work, and yet it does: https://css-tricks.com/the-peculiar-magic-of-flexbox-and-auto-margins/
When Sam says, “that item will automatically extend its specified margin to occupy the extra space in the flex container,” the way my empty filing cabinet brain interprets that is like so:
Setting the margin property on a flex child will push the child away from that direction. Set
margin-left
toauto
, the child will push right. Setmargin-top
toauto
and the child will push to the bottom.[…]
Why is this useful to know? Well, I think there are a few moments where
justify-self
oralign-self
might not get you exactly what you want in a layout where using auto margins gives you that extra flexibility to fine-tune things.Flex.