Lesson

Center an Element Horizontally and Vertically using Flexbox

We have a parent HTML element that takes up the height and width of the page. We will make that parent element into a flex container, and then vertically center its child element using align-items: center;. Finally, we'll use justify-content: center; to...

Duration
1 min
Access
Free
Transcript
Available

We have a parent HTML element that takes up the height and width of the page. We will make that parent element into a flex container, and then vertically center its child element using align-items: center;. Finally, we'll use justify-content: center; to horizontally center the element.