Flexbox

Flexbox

CSS flexible box layout

Table of contents

No heading

No headings in the article.

What is Flexbox?! Flexbox is also called CSS flexible box layout and helps to arrange rows and columns according to the user's needs. Flexbox works inside a parent container, making it easier for elements inside the container to get designed as required by the user.

Properties of Flexbox

display: flex; To apply flex in a class, it is essential to add 'display: flex;' in the HTML code.

display.png

flex-direction Flex directions help to give directions to the elements inside the parent container, the default is a row and with the help of flex directions, we can change it to a column, reverse row or reverse column.

flex-direction.png

flex-wrap Flex wrap is used when there are many elements in a container and it is not organised properly, then flex-wrap is used so that it gets aligned systematically. The default is 'nowrap' which means no change inside the container, but using flex-wrap we can wrap it or we can reverse wrap it.

flex-wrap.png

flex-flow Flex flow is the shorthand properties of flex-direction and flex-wrap. Flex flow holds the capability of two properties because flex-direction and flex-flow are used very often while writing code. So, to save some time while writing code, flex-flow was introduced.

flex-wrap.png

justify-content This property helps to align the items in horizontal form. The default value is 'flex-start' and others are center, flex-end, space-around, space-between and space-evenly.

justify-content.png

align-items This property helps to align the items in vertical form. The values are the same as justify-content.

align-items.png

align-content This property helps to align the items in the container where there are big spaces in between. It only works where there are multiple lines and it doesn't have any effect where there's only one line.

align-content.png

#iwritecode