CSS Flexbox "justify-content: center" Explained - Beginner Tutorial

Publicado em: 31 Outubro 2021
no canal de: Front End Beginners
1,461
16

In this tutorial, we look at "justify-content: center" in CSS Flexbox.

The "justify-content" property aligns items along the "main axis", which always runs along the same plane as the "flex-direction" of the parent container—either horizontally or vertically, based upon "flex-direction: row" or "flex-direction: column".

"justify-content: center" takes any free space inside the parent flex container, divides it in half, and distributes it equally on either side of the child flex items, forcing them together in the center of the container. Note that this alignment works only along the main axis—any free space on the cross axis is ignored.

"justify-content: center" works with a single flex item, or with multiple flex items. As long as there is free space on the main axis, items will be centrally aligned.

We'll look at how this works in both the row and column directions, and how the cross axis is ignored—cross axis alignment is controlled by the "align-items" property, which is a topic for another video.

I hope you found this video helpful. If you have any questions, please leave them in the comments below and I'll do my best to answer as soon as possible.

TIMESTAMPS:

00:00 Introduction
00:25 Default positioning—"justify-content: flex-start"
01:42 How "justify-content: center" works
02:40 Working with multiple flex items
03:41 "justify-content" and the cross axis
05:36 "justify-content: center" and the "column" direction
06:55 Summary

WATCH NEXT:
• CSS Flexbox "justify-content: space-between" Explained -    • CSS Flexbox "justify-content: space-betwee...  
• CSS Flex Direction (flex-direction) Explained -    • CSS Flex Direction (flex-direction) Explai...  
• How to Perfectly Center and Element Using CSS Flexbox -    • How to Perfectly Center an Element Using C...  


Nesta página do site você pode assistir ao vídeo on-line CSS Flexbox "justify-content: center" Explained - Beginner Tutorial duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Front End Beginners 31 Outubro 2021, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 1,461 vezes e gostou 16 espectadores. Boa visualização!