Menu
Coddy logo textTech

flex-direction

Lesson 4 of 15 in Coddy's CSS Flexbox - The Complete Course course.

The flex-direction property defines the direction of the flex items.

It accepts four values:

  • row - flex items from left to right.
  • row-reverse - flex items from right to left.
  • column - flex items from top to bottom.
  • column-reverse - flex items from bottom to top.

The default value of a flex container is row.

Example,

.container {
  display: flex;
  flex-direction: row-reverse;
}
challenge icon

Challenge

Easy

Define the direction of the given flexbox to column-reverse.

Try it yourself

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="styles.css">
</head>
    <body>
        <div class="container">
            <div>1</div>
            <div>2</div>
            <div>3</div>
            <div>4</div>
        </div>
    </body>
</html>

All lessons in CSS Flexbox - The Complete Course