How do I set flex direction?

QuestionsQuestions8 SkillsProCSS Layout BasicsNov, 18 2025
0104

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:

  1. row: (default) Items are arranged horizontally from left to right.
  2. row-reverse: Items are arranged horizontally from right to left.
  3. column: Items are arranged vertically from top to bottom.
  4. 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.

0 Comments

no data
Be the first to share your comment!