I'll start with a picture of what I'm working toward. This is a very common resonsive layout 'grid' of products - cards or whatever - not unlike instagram or dribble or any website that sells things.
The classic conundrum is that you most likely have to use some absolute heights to get something consistent - and absolute heights mean you have to have some logic in place to ensure nothing ever breaks out of that absolute world. Flexbox has many great options to help with things like 'stretching/growing' the main to keep the footer at the bottom / but each choice leans toward a certain markup that inevitably cuts out another option you wanted in the layout. I've generally used JS in the past.
I can hide and show the 'poster' type image markup to create an if else type query that ends up with a different markup - and it'll work to create the layout shown in the diagram. My question is - can this 'float' like thing (shown with arrows) be done with flex-box alone? If I wrap those 2 elements in a parent / I'm no longer able to use the flexbox stuff that makes the other parts of this elegant.
(I'll place my code at the bottom)
Example with only flexbox - that I'm trying to fill in https://codepen.io/sheriffderek/pen/VWgGgv?editors=0100
Example of a different markup - but that won't allow me to use grow and keep the button visually resting at the bottom (I guess I could use absolute positioning here) https://codepen.io/sheriffderek/pen/c12df0754ea9cdd40bb9425a120088d7
Here is an implemetion of @MichaelCoker's suggestion to wrap the main and footer in a parent: https://codepen.io/sheriffderek/pen/weNNMp?editors=0100
But the answer to this question is likely: "No - there is no way to do that without changing the markup and approach." I'm not saying there is a silver bullet- and that all scenarios can be covered, but a parent limits the ability to do things like change the order of the 3 things in the same scope.
Markup:
<ul class='thing-list'>
<li class='thing'>
<header>
HEADER
<figure>
<img src="http://placehold.it/1600x900" alt="">
</figure>
</header>
<main>
MAIN:
<h2>Something...</h2>
</main>
<footer>
FOOTER<br>
<button>Call to action</button>
</footer>
</li>
<!-- ... -->
Styles:
.thing-list
display: flex
flex-direction: column
.thing
display: flex
flex-direction: column
margin-bottom: 2rem
@media (min-width: 450px)
.thing-list
// ?
.thing
// ?
border: 3px solid red
@media (min-width: 700px)
.thing-list
flex-direction: row
flex-wrap: wrap
justify-content: space-between
.thing
flex-basis: 48%
border: 0
main
flex-grow: 1
@media (min-width: 900px)
.thing-list
//
.thing
flex-basis: 32%