Originally posted on dev.to

The time has come to talk about the CSS and the Flexbox layout component. I will briefly describe the CSS properties and at the end of this post, you will find a couple of useful links that will help you learn the Flexbox in a fun way. It's always good to have an interactive way of learning beside reading the dry documentation.

Ok, I've mentioned multiple CSS properties and that means that the Flexbox is an entire module. This is the first thing we need to remember. Because of that, we need to combine both parent's and children's properties in order for the layout to work properly.

Parent properties

  1. display
  2. flex-direction
  3. flex-wrap
  4. flex-flow (a shorthand for flex-direction and flex-wrap)
  5. justify-content
  6. align-items
  7. align-content


This property defines the flex container. It can be flex or inline-flex. By setting this property, we enable the flex context for the child elements.


Flex is a single-direction layout, and by setting this property, we determine the direction of the items within the container.


By default, flex items within the container will try to fit in one line. This can be changed by setting the flex-wrap property.


This is a shorthand for flex-direction and flex-wrap properties. By using this property, we can set both of them correspondingly.


This property determines the allocation of the extra free space between the items over the main axis. It aligns the items across the main axis accordingly.


This property defines how the flex items are laid out based on the cross-axis (vertical line).


Allocates the extra free space, if any, over the cross-axis. It aligns the container lines accordingly.

Children properties

  1. order
  2. flex-grow
  3. flex-shrink
  4. flex-basis
  5. flex
  6. align-self


This property controls the order in which the items appear within the flex container. Negative order is allowed.


Represents the item ability to grow when needed. It defines the amount of the available space that will be reserved for the item. Negative numbers are not allowed.


Similar to flex-grow, this property represents the item ability to shrink when needed. Negative numbers are not allowed.


This property defines the default size of the element before allocating the remaining space. It accepts an actual length, or a keyword as a value.


The shorthand for flex-grow, flex-shrink and flex-basis properties. By setting this we can set all of them accordingly.


This property enables us to override the alignment of the individual item.

Ok, the list with the short explanations should be enough to get you started, and as I promised, here are a couple of cool links that will make the learning process pretty interesting. One of them was used as a base for this post.

  1. flexbox-froggy
  2. flexbox-defense
  3. complete flexbox guide