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! While you're at it, check out some resources Treehouse students have shared here.

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 to have a blank line in first example?

In the first example after the min-height, he double spaces and skips a line. I thought he did this by mistake or maybe just because he wanted to. When I entered WorkSpace and didn't include that empty line after the min-height, my code didn't work properly. When I do add the empty space all of a sudden it works. I was wondering why that is?

1 Answer

It should not be a problem giving space. Maybe you have not used the display property. It always helps to post your code here for us to check. When you work with:

justify-content: center;
align-items: center;

You must always use a display property with a value of flex. Like this:

display: flex;
justify-content: center;
align-items: center;

Something must have been wrong with my computer yesterday. Every time I wrote the code without the empty space I kid you not it wouldn't work. But today it seems to work fine. Thank you for your response!

I am glad it has finally worked for you! :)