Flexbox Basic Properties

display:flex;

The first thing that is done is to enter the container ID within css, and change the display to flex. This creates a so-called flex container.

            
                #container {
                    background-color: #003049;
                    width: 90%;
                    height: 500px;
                    margin: 0 auto;
                    border: 5px solid #003049;
                    display:flex;
                }
            
        

flex-direction

In the Flex model, we have a main-axis which initially goes from left to right, and a cross axis which intially goes from top to bottom.

The flex-direction property determines the direction in which the flex items are laid out within a flex container. By default, flex items are laid out in a row from left to right.

However, you can use flex-direction to change the direction to a column from top to bottom, or to make rows that are reversed from right to left or bottom to top.

Essentially, flex-direction sets the direction in which flex items are laid out along the main axis.

Advantages of using flex-direction

Changing the Flex Model

justify-content

The Flexbox property justify-content is used to align flex items along the main axis of a flex container. It can be set to flex-start, center, flex-end, space-between, space-around, or space-evenly.

The justify-content property is used to align flex items along the main axis of a flex container. Later, you'll see that a property called align-items, which is used to align items along the cross-axis. In either case, the main axis could be the horizontal (x-axis) or vertical (y-axis) axis: it depends on the flex-direction value!

Pros and cons of utilizing justify-content:

Justifying The Content

On to the next part