You can set the flex direction by using the CSS property flex-direction within the style of a flex container. The flex-direction property accepts the following values:
- row: (default) Items are arranged horizontally from left to right.
- row-reverse: Items are arranged horizontally from right to left.
- column: Items are arranged vertically from top to bottom.
- column-reverse: Items are arranged vertically from bottom to top.
Here’s an example of how to set the flex direction in CSS:
.flex-container {
display: flex;
flex-direction: column; /* Change this value to row, row-reverse, or column-reverse as needed */
}
In this example, the flex items within the .flex-container will be arranged vertically due to the flex-direction: column; property. You can change the value of flex-direction to achieve different layouts.
