Coding task · HTML and CSS course · Module 4: Flexbox
Perfect Centering of an Element
Combining justify-content: center and align-items: center gives you perfect centering of an element both horizontally and vertically. This is one of the most popular CSS techniques - it used to be very difficult, but with Flexbox it's incredibly simple!
Task
Center an element both vertically and horizontally using justify-content: center and align-items: center on a 300x300px flex container.