Content pfp
Content
@
0 reply
0 recast
0 reaction

Darryl Yeo đŸ› ïž pfp
Darryl Yeo đŸ› ïž
@darrylyeo
A serious guide to centering a <div> in CSS – 2024 edition! Soon, `align-content: center;` (without `display: flex;` or `display: grid;`) may be all that you need. https://www.joshwcomeau.com/css/center-a-div/
4 replies
3 recasts
21 reactions

Phil Cockfield pfp
Phil Cockfield
@pjc
This historical difficulty of centring things vertically in CSS was like one of those little "fossil record" hints or clues to where this crazy thing all came from. Publishing scientific "documents" at CERN... not application layout out all. How much cortisol has been spilled failing at the task of centering shit?!
1 reply
0 recast
0 reaction

Darryl Yeo đŸ› ïž pfp
Darryl Yeo đŸ› ïž
@darrylyeo
Sometime around 2015 I had to vertically center the output of a WordPress plugin in the viewport without editing the markup. My solution? Something like this: ``` display: table !important; height: 100vh !important; display: table-cell !important; vertical-align: middle; ``` Good times 👌
1 reply
0 recast
1 reaction