What is Flexbox?

Untitled

Flexbox is a one-dimensional layout method for arranging items in rows or columns. Items flex(expand) to fill additional space or shrink to fit into smaller spaces. Flexbox makes a lot of layout tasks much easier.

Untitled

Since flexbox is a whole module and not a single property, it involves a lot of things including its whole set of properties. Some of them are meant to be set on the container (parent element, known as “flex container”) whereas the others are meant to be set on the children (said “flex items”).

The flex container becomes flexible by setting the display  property to flex.

.container{
		display:flex;
}

The flex container properties are:

1. Flex-direction

Flex-direction property is used to give direction to element should be placed, four types of properties are defined.

.flex-container {
  display: flex;
  flex-direction: column;
}

Untitled

2. Flex-wrap

Flex-wrap property is used for wrapping flex-items inside the flex-container.