Start appyling display: flex; property to parent element
This will take the all the elements in horizontal direction
This will take the all the elements in horizontal direction
You can also change the direction of elements. For doing so, you need to mention the flex-direction property
The flex-direction property specifies the direction of the items within the flex container
The flex-direction property specifies the direction of the items within the flex container
After applying row, row-reverse, column and column-reverse in flex-direction
They all are pretty intuitive.
They all are pretty intuitive.
As you can see our elements have shrunk a bit. This is becasue we haven't applied the flex-wrap property.
It defines whether the flex items are forced in a single line or can be flowed into multiple lines depending on screen size
.parent {
flex-wrap: wrap;
}
It defines whether the flex items are forced in a single line or can be flowed into multiple lines depending on screen size
.parent {
flex-wrap: wrap;
}
Time to align flexible items with flex container
Justify-content: For horizontal alignment
Align-content: For vertical alignment


The justify-content property aligns the items within flex container.
- flex-start
- flex-end
- center
- space- between (Items will equal space between them)
- space-around (equal space b/w elements with half left side and half right side)
- space-evenly
- flex-start
- flex-end
- center
- space- between (Items will equal space between them)
- space-around (equal space b/w elements with half left side and half right side)
- space-evenly
You can also position a particular item inside flex container
https://twitter.com/Prathkum/status/1359779243115257861?s=20
For example:
https://twitter.com/Prathkum/status/1359779243115257861?s=20
For example: