Menu
Coddy logo textTech

flex-wrap

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

The flex-wrap property defines if the flex items should wrap or not.

Possible values - wrap, nowrap, wrap-reverse (wrap in reverse order).

The default value of a flex container is nowrap.

Example,

.container {
  display: flex;
  flex-wrap: wrap;
}

Wrap is a concept where if the elements don't have space they wrap into the next row or column (line)

challenge icon

Challenge

Easy

Define the wrap of the given flexbox to wrap-reverse.

You should try all the values!

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>5</div>
            <div>6</div>
            <div>7</div>
            <div>8</div>
            <div>9</div>
            <div>10</div>
            <div>11</div>
            <div>12</div>
        </div>
    </body>
</html>

All lessons in CSS Flexbox - The Complete Course