Categories
Web development

CSS flex-flow Property

CSS flex-flow Property

The CSS flex-flow property is a shorthand property for:

Syntax:

flex-flow: flex-direction flex-wrap;

flex-direction (value – row/ row-reverse/ column/ column-reverse) – defining the direction of the flexible items.

flex-wrap (value – nowrap/ wrap/ wrap-reverse) – defining whether the flexible items should wrap or not.

Example:

<!DOCTYPE html>
<html>
<head>
<style> 
#box-container {
  width: 200px;
  height: 200px;
  border: 3px solid #333;
  display: flex;
  flex-flow: row-reverse wrap;
}

#box-container div {
  width: 50px;
  height: 50px;
}
</style>
</head>
<body>

<div id="box-container">
  <div style="background-color:#264653;color: white;">1</div>
  <div style="background-color:#2a9d8f;">2</div>
  <div style="background-color:#e9c46a;">3</div>
  <div style="background-color:#e76f51;">4</div>
  <div style="background-color:#f4a261;">5</div>
  <div style="background-color:#264653;color: white;">6</div>
</div>

</body>
</html>

Output:

1
2
3
4
5
6

Note: Internet Explorer 10 and earlier versions do not support the flex-flow property!

Enjoy coding!

Read also:

CSS flex-wrap Property

CSS flex-grow Property