#Suggested structure

3 messages · Page 1 of 1 (latest)

terse pilot
#

Hello, id like to place number 2 to be placed horizontally center of the whole body.

the way i can think of is:

  1. make a flex div and put 1,2 inside and adjust width or margin.

I would like to come up with a more clean and straightforward way to do this.

I appreciate for help.

weary crow
#

the trick there is to create a separate "stacking context" in the parent container (the one that is centered), using position: relative, so that the child element can use position: absolute and have that now refer to the parent container instead of the document root regarding coordinate system origin during placement