{"id":9083,"date":"2022-10-12T15:26:17","date_gmt":"2022-10-12T14:26:17","guid":{"rendered":"https:\/\/stevepedwards.today\/DebianAdmin\/?p=9083"},"modified":"2023-10-28T23:51:34","modified_gmt":"2023-10-28T22:51:34","slug":"css-flex-positioning-options","status":"publish","type":"post","link":"https:\/\/stevepedwards.today\/DebianAdmin\/css-flex-positioning-options\/","title":{"rendered":"CSS Flex Positioning Options"},"content":{"rendered":"<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_9083\" class=\"pvc_stats all  \" data-element-id=\"9083\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n<p>Because flex is such a powerful and common selector, I've summarised most of it's useful aspects, in a short enough document, so even Joe might read it..(lots of pics, min text) lol!<\/p>\n<pre class=\"lang:default decode:true \">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en\"&gt;\r\n&lt;head&gt;\r\n    &lt;meta charset=\"UTF-8\"&gt;\r\n    &lt;meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"&gt;\r\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;\r\n    &lt;title&gt;Document&lt;\/title&gt;\r\n    &lt;link rel=\"stylesheet\" href=\"styles.css\"&gt;\r\n    &lt;style&gt;\r\n        .item {\r\n            border: 1px solid black;\r\n            background-color: #777;\r\n            width: 75px;\r\n            color: yellow;\r\n            margin: 10px;\r\n        }\r\n\r\n        \/* Using display: block, element behaviour inside it's parent is changed. Flex changes how all the children - 1 LEVEL below only (not grandchildren)! - behave inside their main container*\/\r\n        .container {\r\n            \/* margins DO NOT collapse in Flex! It 1D in the sense the doc flow is either L-R(X axis) or T-B(Y axis)  so next to, or stacked. Default is justify-content: flex-start;*\/\r\n            \/* flex-end, center, space-between, space-around *\/\r\n            display: flex;\r\n            background-color: #CCC;\r\n            border: 1px solid;\r\n            justify-content: space-evenly;\r\n        }\r\n\r\n        .item1  {\r\n            height: 50px;\r\n        }\r\n        \r\n        .item2  {\r\n            height: 100px;\r\n        }\r\n        \r\n        .item3  {\r\n            height: 150px;\r\n        }\r\n       \r\n    &lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;!-- div s are display block elements so can't have anything next to them so stack on top --&gt;\r\n    &lt;div class=\"container\"&gt;\r\n        &lt;div class=\"item item1\"&gt;1&lt;\/div&gt;\r\n        &lt;div class=\"item item2\"&gt;2&lt;\/div&gt;\r\n        &lt;div class=\"item item3\"&gt;3&lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<pre class=\"lang:default decode:true\">.container {\r\n            \/* margins DO NOT collapse in Flex! It 1D in the sense the doc flow is either L-R(X axis) or T-B(Y axis)  so next to, or stacked. Default is justify-content: flex-start;*\/\r\n            \/* flex-end, center, space-between, space-around *\/\r\n            \/* display: flex;\r\n            background-color: #CCC;\r\n            border: 1px solid;\r\n            \r\n        }<\/pre>\n<div>\n<div>\/* Using display: block, element behaviour inside it's parent is changed. Flex changes how all the children - 1 LEVEL below only (not grandchildren)! - behave inside their main container *\/<\/div>\n<div>\n<div>\n<div>\/* justify-content:\u00a0 (space-evenly;\u00a0 flex-end, center, space-between, space-around) *\/<\/div>\n<\/div>\n<div>No Flex:<\/div>\n<\/div>\n<\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9084 \" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/NoFlex-148x300.png\" alt=\"\" width=\"799\" height=\"1620\" \/> display: flex;<\/p>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9088 \" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/Flexed-148x300.png\" alt=\"\" width=\"612\" height=\"1241\" \/><\/div>\n<div>\n<div>justify-content:\u00a0 flex-end;<\/div>\n<div><\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9090\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/JCflex-end-300x161.png\" alt=\"\" width=\"760\" height=\"408\" \/><\/div>\n<div>justify-content:\u00a0 center;<\/div>\n<div><\/div>\n<\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9091\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/JCCenter-300x161.png\" alt=\"\" width=\"857\" height=\"460\" \/><\/div>\n<p>justify-content: space-between;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9101\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/JCspace-between-1-300x161.png\" alt=\"\" width=\"855\" height=\"459\" \/><\/p>\n<p>justify-content: space-around;<\/p>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9103\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/JCspace-around-300x161.png\" alt=\"\" width=\"768\" height=\"412\" \/><\/div>\n<div>\n<div>justify-content: space-evenly;<\/div>\n<\/div>\n<div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9105\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/JCspace-evenly-300x161.png\" alt=\"\" width=\"792\" height=\"425\" \/><\/p>\n<p>For X axis positioning:<\/p>\n<pre class=\"lang:default decode:true\">.container {\r\n            \/* margins DO NOT collapse in Flex! It 1D in the sense the doc flow is either L-R(X axis) or T-B(Y axis)  so next to, or stacked. Default is justify-content: flex-start;*\/\r\n            \/* flex-end, center, space-between, space-around *\/\r\n            display: flex;\r\n            background-color: #CCC;\r\n            border: 1px solid;\r\n            \/* For X axis align default is stretch so elements stay symmetrical with browser size - up to a limit *\/\r\n            align-items: stretch;\r\n        }<\/pre>\n<p>Default is:<\/p>\n<p>align-items: stretch;<\/p>\n<pre class=\"lang:default decode:true\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en\"&gt;\r\n&lt;head&gt;\r\n    &lt;meta charset=\"UTF-8\"&gt;\r\n    &lt;meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"&gt;\r\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;\r\n    &lt;title&gt;Document&lt;\/title&gt;\r\n    &lt;link rel=\"stylesheet\" href=\"styles.css\"&gt;\r\n    &lt;style&gt;\r\n        .item {\r\n            border: 1px solid black;\r\n            background-color: #777;\r\n            width: 75px;\r\n            color: yellow;\r\n            margin: 10px;\r\n        }\r\n\r\n        \/* Using display: block, element behaviour inside it's parent is changed. Flex changes how all the children - 1 LEVEL below only (not grandchildren)! - behave inside their main container*\/\r\n        .container {\r\n            \/* margins DO NOT collapse in Flex! It 1D in the sense the doc flow is either L-R(X axis) or T-B(Y axis)  so next to, or stacked. Default is justify-content: flex-start;*\/\r\n            \/* flex-end, center, space-between, space-around *\/\r\n            display: flex;\r\n            background-color: #CCC;\r\n            border: 1px solid;\r\n            \/* For X axis align default is stretch so if elements are set to a min-height, they all grow to same height as tallest element*\/\r\n            align-items: stretch;\r\n        }\r\n\r\n        .item1  {\r\n            min-height: 50px;\r\n        }\r\n        \r\n        .item2  {\r\n            min-height: 100px;\r\n        }\r\n        \r\n        .item3  {\r\n            min-height: 150px;\r\n        }\r\n       \r\n    &lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;!-- divs are display block elements so can't have anything next to them so stack on top --&gt;\r\n    &lt;div class=\"container\"&gt;\r\n        &lt;div class=\"item item1\"&gt;1&lt;\/div&gt;\r\n        &lt;div class=\"item item2\"&gt;2&lt;\/div&gt;\r\n        &lt;div class=\"item item3\"&gt;3&lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>align-items: stretch;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9110\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/minheightstretch-300x161.png\" alt=\"\" width=\"898\" height=\"482\" \/><\/p>\n<div>\n<div><\/div>\n<div>\n<div>\n<div>align-items: center;<\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9108\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/align-center-300x161.png\" alt=\"\" width=\"675\" height=\"362\" \/><\/div>\n<div>\n<p>If,<\/p>\n<div>\n<div>justify-content: center;<\/div>\n<div>is used also:<\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9112\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/JCCenterAlignCenter-300x161.png\" alt=\"\" width=\"686\" height=\"368\" \/><\/div>\n<div>\n<div>\n<div>align-items: flex-end;<\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9114\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/JCflex-endAlignCenter-300x161.png\" alt=\"\" width=\"898\" height=\"482\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div>Flex wrap is useful for reduced browser size, as elements flow around each other as space decreases. From above view to:<\/div>\n<div><\/div>\n<\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9116\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/flex-wrap-156x300.png\" alt=\"\" width=\"818\" height=\"1573\" \/><\/div>\n<div>For symmetrical collapse:<\/div>\n<\/div>\n<\/div>\n<div>\n<pre class=\"lang:default decode:true \">.container {\r\n            \/* margins DO NOT collapse in Flex! It 1D in the sense the doc flow is either L-R(X axis) or T-B(Y axis)  so next to, or stacked. Default is justify-content: flex-start;*\/\r\n            \/* flex-end, center, space-between, space-around *\/\r\n            display: flex;\r\n            background-color: #CCC;\r\n            border: 1px solid;\r\n            \/* for X axis *\/\r\n            justify-content: space-around;\r\n            \/* for Y axis *\/\r\n            align-content: space-around;\r\n            align-items: center;\r\n            flex-wrap: wrap;\r\n        }<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<div>\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9118\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/SymCollapse-147x300.png\" alt=\"\" width=\"820\" height=\"1673\" \/><\/p>\n<p>For the same effects on the Y axis, we can change that to be the main axis with, flex-direction: column;<\/p>\n<\/div>\n<div>\n<div>\n<pre class=\"lang:default decode:true\">.container {\r\n            \/* margins DO NOT collapse in Flex! It 1D in the sense the doc flow is either L-R(X axis) or T-B(Y axis)  so next to, or stacked. Default is justify-content: flex-start;*\/\r\n            \/* flex-end, center, space-between, space-around *\/\r\n            display: flex;\r\n            background-color: #CCC;\r\n            border: 1px solid;\r\n            flex-direction: column;\r\n        }<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9121\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/FlexDirCol-147x300.png\" alt=\"\" width=\"658\" height=\"1343\" \/><\/p>\n<\/div>\n<div>\n<div>Easily switch axes back with flex-direction: row;<\/div>\n<\/div>\n<\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9123\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/FlexDirRow-147x300.png\" alt=\"\" width=\"873\" height=\"1782\" \/><\/div>\n<div>Flex-grow is great for taking up remaining space in a page or changing how much remaining space is shared between elements:<\/div>\n<\/div>\n<div><\/div>\n<div>\n<pre class=\"lang:default decode:true\">.item3  {\r\n            min-height: 150px;\r\n            flex-grow: 1;\r\n        }<\/pre>\n<\/div>\n<div><\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9126\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/FlexGrow3-300x161.png\" alt=\"\" width=\"876\" height=\"470\" \/><\/div>\n<div>If item 2 is also set to flex-grow:2<\/div>\n<div><\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9128\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/FlexGrow2-300x161.png\" alt=\"\" width=\"827\" height=\"444\" \/><\/div>\n<div><\/div>\n<div>\n<div>This is done with a proportionality of remaining space between items and their current size, so item 2 is NOT twice the size of item 3, as they already have a fixed width of 75px:<\/div>\n<div>\n<pre class=\"lang:default decode:true \">.item {\r\n            border: 1px solid black;\r\n            background-color: #777;\r\n            width: 75px;\r\n            color: yellow;\r\n            margin: 10px;\r\n        }<\/pre>\n<p>So the remaining\u00a0 space is shared between items 2 and 3 in a 2:1 ratio<\/p>\n<\/div>\n<\/div>\n<div>This isa bit easier to understand if all items are set to flex-grow: 1.<\/div>\n<div><\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9129\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/equal-300x161.png\" alt=\"\" width=\"762\" height=\"409\" \/><\/div>\n<div>There is an 8px default margin around the main container.<\/div>\n<div>Remaining space up to that margin is shared into 4 non collapsing border sections between div elements and edges of the parent container, in 6 equal parts, so give equal border around each element, so these add together between item2 and it's neighbours.<\/div>\n<div><\/div>\n<div>By default all items have a flex-shrink of 1, but can be changed per item.<\/div>\n<div>I changed the default widths larger for clarity.<\/div>\n<div>If you don't want an item to shrink as to the others, you can set it to 0:<\/div>\n<div><\/div>\n<div>\n<pre class=\"lang:default decode:true\">&lt;style&gt;\r\n        .item {\r\n            border: 1px solid black;\r\n            background-color: #777;\r\n            width: 100px;\r\n            color: yellow;\r\n            margin: 10px;\r\n        }\r\n\r\n        \/* Using display: block, element behaviour inside it's parent is changed. Flex changes how all the children - 1 LEVEL below only (not grandchildren)! - behave inside their main container*\/\r\n        .container {\r\n            \/* margins DO NOT collapse in Flex! It 1D in the sense the doc flow is either L-R(X axis) or T-B(Y axis)  so next to, or stacked. Default is justify-content: flex-start;*\/\r\n            \/* flex-end, center, space-between, space-around *\/\r\n            display: flex;\r\n            background-color: #CCC;\r\n            border: 1px solid;\r\n            \/* for X axis\r\n            justify-content: space-around;\r\n            \/* for Y axis *\/\r\n            \/* align-content: space-around;\r\n            align-items: center;\r\n            flex-wrap: wrap; *\/\r\n            \/* flex-direction: row;*\/\r\n        }\r\n\r\n        .item1  {\r\n            min-height: 50px;\r\n            flex-shrink: 0;\r\n        }\r\n        \r\n        .item2  {\r\n            min-height: 100px;\r\n            \/* flex-shrink: 1; *\/\r\n        }\r\n        \r\n        .item3  {\r\n            min-height: 150px;\r\n            \/* flex-shrink: 1; *\/\r\n        }\r\n       \r\n    &lt;\/style&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p>flex-shrink: 0;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9132\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/flex-shrink0-147x300.png\" alt=\"\" width=\"877\" height=\"1790\" \/><\/p>\n<\/div>\n<div>\n<p>So, the item with a flex shrink of 3 shrinks 3 times faster than the item with a shrink of 1, down to min browser width. In my Chrome browser, the zoom has to be at 150% to see this effect at these 100px widths:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9134\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/flex-shrink3to1-147x300.png\" alt=\"\" width=\"733\" height=\"1496\" \/><\/p>\n<\/div>\n<p>The align-self selector allows each div to be aligned within the parent container:<\/p>\n<pre class=\"lang:default decode:true \">.item1  {\r\n            align-self: flex-start;\r\n            min-height: 50px;\r\n            \/* flex-shrink: 3; *\/\r\n        }\r\n        \r\n        .item2  {\r\n            align-self: center;\r\n            min-height: 100px;\r\n            \/* flex-shrink: 1; *\/\r\n        }\r\n        \r\n        .item3  {\r\n            min-height: 150px;\r\n            \/* flex-shrink: 1; *\/\r\n        }<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9137\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/align-self-147x300.png\" alt=\"\" width=\"862\" height=\"1759\" \/><\/p>\n<p>The order of the items document flow can also be changed with order: x selector:<\/p>\n<pre class=\"lang:default decode:true \">.item1  {\r\n            align-self: flex-start;\r\n            min-height: 50px;\r\n            order: 2;\r\n            \/* flex-shrink: 3; *\/\r\n        }\r\n        \r\n        .item2  {\r\n            order: 3;\r\n            align-self: center;\r\n            min-height: 100px;\r\n            \/* flex-shrink: 1; *\/\r\n        }\r\n        \r\n        .item3  {\r\n            order: 1;\r\n            min-height: 150px;\r\n            \/* flex-shrink: 1; *\/\r\n        }<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9138\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/order312-147x300.png\" alt=\"\" width=\"859\" height=\"1753\" \/><\/p>\n<p>Ordering starts at 0, so an item without an order number will be first in the flow. Negative numbers apply too. It's not recommended to use order as it alters the order of tabbed items and screen read elements as it doesn't change the HTML element order, obviously.<\/p>\n<p>Finally, the flex container can be changed to act like an inline block too with display: inline-flex;<\/p>\n<pre class=\"lang:default decode:true\">&lt;head&gt;\r\n    &lt;meta charset=\"UTF-8\"&gt;\r\n    &lt;meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"&gt;\r\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;\r\n    &lt;title&gt;Document&lt;\/title&gt;\r\n    &lt;link rel=\"stylesheet\" href=\"styles.css\"&gt;\r\n    &lt;style&gt;\r\n        .item {\r\n            border: 1px solid black;\r\n            background-color: #777;\r\n            width: 75px;\r\n            color: yellow;\r\n            margin: 10px;\r\n        }\r\n\r\n        \/* Using display: block, element behaviour inside it's parent is changed. Flex changes how all the children - 1 LEVEL below only (not grandchildren)! - behave inside their main container*\/\r\n        .container {\r\n            \/* margins DO NOT collapse in Flex! It 1D in the sense the doc flow is either L-R(X axis) or T-B(Y axis)  so next to, or stacked. Default is justify-content: flex-start;*\/\r\n            \/* flex-end, center, space-between, space-around *\/\r\n            display: inline-flex;\r\n            background-color: #CCC;\r\n            border: 1px solid;\r\n            \/* for X axis\r\n            justify-content: space-around;\r\n            \/* for Y axis *\/\r\n            \/* align-content: space-around;\r\n            align-items: center;\r\n            flex-wrap: wrap; *\/\r\n            \/* flex-direction: row;*\/\r\n        }\r\n\r\n        .item1  {\r\n            align-self: flex-start;\r\n            min-height: 50px;\r\n            order: 2;\r\n            \/* flex-shrink: 3; *\/\r\n        }\r\n        \r\n        .item2  {\r\n            order: 3;\r\n            align-self: center;\r\n            min-height: 100px;\r\n            \/* flex-shrink: 1; *\/\r\n        }\r\n        \r\n        .item3  {\r\n            order: 1;\r\n            min-height: 150px;\r\n            \/* flex-shrink: 1; *\/\r\n        }\r\n       \r\n    &lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;!-- divs are display block elements so can't have anything next to them so stack on top --&gt;\r\n    &lt;div class=\"container\"&gt;\r\n        &lt;div class=\"item item1\"&gt;1&lt;\/div&gt;\r\n        &lt;div class=\"item item2\"&gt;2&lt;\/div&gt;\r\n        &lt;div class=\"item item3\"&gt;3&lt;\/div&gt;    \r\n    &lt;\/div&gt;\r\n    &lt;span&gt;This is a span&lt;\/span&gt;\r\n&lt;\/body&gt;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-9143\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/uploads\/2022\/10\/inline-flex-234x300.png\" alt=\"\" width=\"718\" height=\"921\" \/><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_9083\" class=\"pvc_stats all  \" data-element-id=\"9083\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n<p>Because flex is such a powerful and common selector, I've summarised most of it's useful aspects, in a short enough document, so even Joe might read it..(lots of pics, min text) lol! &lt;!DOCTYPE html&gt; &lt;html lang=\"en\"&gt; &lt;head&gt; &lt;meta charset=\"UTF-8\"&gt; &lt;meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"&gt; &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt; &lt;title&gt;Document&lt;\/title&gt; &lt;link rel=\"stylesheet\" href=\"styles.css\"&gt; &lt;style&gt; .item { border: 1px <a href=\"https:\/\/stevepedwards.today\/DebianAdmin\/css-flex-positioning-options\/\" class=\"more-link\">...<span class=\"screen-reader-text\">\u00a0 CSS Flex Positioning Options<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-9083","post","type-post","status-publish","format-standard","hentry","category-post"],"a3_pvc":{"activated":true,"total_views":2,"today_views":0},"_links":{"self":[{"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/posts\/9083","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/comments?post=9083"}],"version-history":[{"count":58,"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/posts\/9083\/revisions"}],"predecessor-version":[{"id":10082,"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/posts\/9083\/revisions\/10082"}],"wp:attachment":[{"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/media?parent=9083"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/categories?post=9083"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/tags?post=9083"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}