CSS CSS Flexbox Layout Flexbox Properties Vertical and Horizontal Centering

Florian Neubauer
Florian Neubauer
5,649 Points

Center the container?

Hey guys! Can I somehow center the container itself? For my personal page I have an about page that displays an image, a header and a paragraph (displayed as a column with flexbox). When I apply a max-width to my container in order to avoid the paragraph's text expand to much, at a certain browserwidth the container and its items won't be centered to the page anymore.

Best Florian

Florian Neubauer
Florian Neubauer
5,649 Points

I think that I got the problem.. I didn't see the right margin that was applied to the container.

Best

Nouh Ahmed
Nouh Ahmed
7,085 Points

I tried to center the container itself it didn't. I flowed the steps of the video, but i tried to center instead of centering the .item class of the div element.

1 Answer

Alexandr Bessmertnov
seal-mask
.a{fill-rule:evenodd;}techdegree
Alexandr Bessmertnov
Front End Web Development Techdegree Student 16,542 Points

hey there!

if you want to center the parent flex container in another container, then just give it the properties ..to another container display: flex; justify-content: center; align-items: center; as u see everything is simple.