2 ms·
I challenge OP to center a <div> in an arbitrary container using CSS. Good luck.
by tjwebbnorfolk 10mo ago
I challenge OP to center a <div> in an arbitrary container using CSS.
Good luck.
- oneeyedpigeon 10mo ago.container { display: flex; justify-content: center; align-items: center; }
- nicoburns 10mo agoOr even: .container { display: grid; place-items: center; }
- tjwebbnorfolk 10mo agoThat's not an arbitrary container, that's a container you're defining right there
- oneeyedpigeon 10mo agoOk: *:has(> #your-div-id) { display: flex; justify-content: center; align-items: center; } If that's not an "arbitrary container", please explain what is and I'll give it another go!