/

HTML / CSS / JavaScript Tutorial

CSS Property: flex-flow

[this page | pdf | back links]

The CSS (CSS3) flex-flow property is a shorthand property for setting certain flex properties for a flex element.

 

Valid property values (other than inherit and initial) are defined by the elements of the shorthand. Shorthand elements (in the order in which they appear):

 

-        flex-direction

-        flex-wrap

 

Default Value:

row nowrap

JavaScript syntax:

e.g. object.style.flexFlow="column nowrap"

Inherited:

No

Animatable:

See individual properties

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head>
<style>
.x1 {display: flex; flex-flow: column wrap-reverse;}
</style>
</head>
<body>
1. Element with default property<br>
<div style="display: flex;">
<div>text 1</div><div>text 2</div><div>text 3</div>
</div>
<br>
2. Element set using in-file HTML style<br>
<div class="x1">
<div>text 1</div><div>text 2</div><div>text 3</div>
</div>
<br>
3. Element set using JavaScript<br>
<div id="x2">
<div>text 1</div><div>text 2</div><div>text 3</div>
</div>
<br>

<script>
document.getElementById("x2").style.display = "flex";
document.getElementById("x2").style.flexFlow = "column wrap-reverse";
</script>

</body>
</html>

FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedCSSPropertyFlexFlow() {
  var x = document.createElement("DIV"); x.style.flexFlow = "column wrap-reverse"; return (window.getComputedStyle(x, null).flexFlow == "column wrap-reverse");
}


NAVIGATION LINKS
Contents | Prev | Next | CSS Properties


Desktop view | Switch to Mobile