Challenge solution: The challenge is to center a div both horizontally and vertically using flexbox without fixed pixel offsets or absolute positioning.
Why:
By setting ‘display: flex’ on the parent container ‘.stage’, we enable flexbox layout. ‘justify-content: center’ centers the flex items along the main axis (horizontally in a row-direction flex container). ‘align-items: center’ centers the flex items along the cross axis (vertically in a row-direction flex container), achieving perfect centering.