Flexbox issues?

Hi, I am having a really tough time figuring out flexbox. In my current code I am just wanting to centre a box on each axis, so the box is in the very middle of the page, I can get it to centre on the main axis but not the cross axis, can anyone tell me where I am going wrong.

In your parent div, I would give that a class of .flex-container and set the display property there. Your child div is the actual box so that’s where I would have .box. The flex container also needs a height, otherwise the box will think, “…center of what exactly?”

Thank you, I now have it working. I dont know why I am having such a tough time with flexbox, just cant seem to grasp it.

1 Like