21days-responsive-css-challenge

Tutorial 1 | Flexbox Containers

Flex & flex-wrap :

justify-content :

What if we switch our flex-direction to column ?

Ans. The justify-content will work now up & down.

flex-direction-column illustration

All the property that applied to the items horizontally will apply now vertically.

for e.g. Now, justify-content: center will vertically center the element.

Rest of the values will work same as that.

align-items :

Another one we have is align-items it deals with the flex-items vertically or we can say on the cross-axis. whereasjustify-content works on the main-axis.

Note : When the flex-direction is changed from row to column the behaviour of justify-content and align-items changes too. They interchange their behaviour. justify-content works as align-items whereas align-items works as the justify-content.

Some values to the align-items :

Now Another thing that can be confusing is something called align-content and that’s coz align-content has a sort of a mid it has the same properties as the justify-content they both have a content in them so i guess that makes sense so we don’t have the baseline option and we do have space-between & space-around.

align-content :

Now, align-content only works if you have multiple lines of content right now it’s not gonna do anything and it also conflicts with align-items.

Difference b/w align-items & align-content :

align-items aligns the each item in a line. whereas the align-content aligns the whole content.

See below images to understand the diff. :