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

furkan
furkan
10,278 Points

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!

furkan
furkan
10,278 Points

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