Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Flexbox Layout Flexbox Properties Vertical and Horizontal Centering

Why do we need something for both container and item to center?

When I tried using only justify content on the container it centered the content with no issue. So why in the video did it say there are three ways and none of the ways were using justify-content: center only on the container?

1 Answer

Jordan Davis
Jordan Davis
7,696 Points

Im pretty sure that because it was only one item in the container that the justify-content will do the trick by its self, however with more items inside and possible differnet dimensions/positioning, you may need to align the items on the cross (vertical in this case) axis with align-content/align-self.

Hope this made sense :)