GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||
GeezerVison is showing developer.mozilla.org — flex-flow CSS property - CSS | MDN
|
| Initial value | as each of the properties of the shorthand:
|
|---|---|
| Applies to | flex containers |
| Inherited | no |
| Computed value | as each of the properties of the shorthand:
|
| Animation type | as each of the properties of the shorthand:
|
flex-flow =
<'flex-direction'> ||
<'flex-wrap'>
<flex-direction> =
row |
row-reverse |
column |
column-reverse
<flex-wrap> =
nowrap |
[ wrap | wrap-reverse ] || balance
This example demonstrates using the flex-flow shorthand on a flex container so the items are laid out backwards across multiple rows.
We include a list of words in alphabetical order:
<ul>
<li>Alphabet</li>
<li>Banana</li>
<li>Crayons</li>
<li>Dinosaurs</li>
<li>Eggplant</li>
<li>Foundation</li>
<li>Ghosts</li>
<li>Happy</li>
<li>Igloo</li>
<li>Janitors</li>
<li>Kittens</li>
<li>Lasso</li>
<li>Magic 8-ball</li>
<li>Nincompoop</li>
<li>Orange</li>
<li>Petunia</li>
<li>Quality</li>
<li>Rancid</li>
<li>Shoelace</li>
<li>Terydactyl</li>
<li>Umbrella</li>
<li>Valentine</li>
<li>Westward</li>
<li>Xylophone</li>
</ul>
We set the <ul> to be a flex container with the display property, define a width, add a gap so there is some room between flex items and flex lines, and then set the flex-flow to wrap the items in reverse order. Additional CSS has been hidden for brevity.
ul {
display: flex;
width: 31em;
gap: 1em;
flex-flow: row-reverse wrap-reverse;
}
ul {
list-style: none;
border: 1px solid;
font-family: sans-serif;
}
li {
font-size: 1.25rem;
padding: 5px;
border: 1px solid;
background-color: lightpink;
}
li:nth-of-type(even) {
background-color: lightgreen;
}
| Specification |
|---|
| CSS Flexible Box Layout Module Level 1 # flex-flow-property |