I don't believe that what I'm asking for is yet achievable in pure CSS but I'm going to ask anyway in hopes there is another approach or something I'm missing.
Here is an illustration of my current layout, achieved with flexbox:
This works perfectly. But what if I add more content to column 1, below the "column within column" div. And then I want to also add content to Column 2, but I want it to occupy the same vertical space as the item I've just added to column 1? In other words, as if everything was a table and those items where in the same row in adjacent table cells?
This is a common issue when laying out forms for example, where you want to group items (city, state, zip) in columns and you want to track things side by side down the form.
(I've just got the gray borders around the columns to help delineate the markup, but typically their would not be borders between the columns on a multi-column form layout)
So, the end result would appear as in the second image below:
Here is the structural HTML for the demo:
.container {
display: flex;
}
.column {
flex-grow: 1;
/* fill parent space based on child content */
flex: 1 1 0;
/* fill parent space equally regardless of child content*/
}
.column.row {
display: flex;
flex-wrap: wrap;
}
.column.row div {
flex-grow: 1;
}
.column.row h2 {
width: 100%;
}
<div class="container">
<div class="column">
<h1>Column 1 Layout Goes here</h1>
<div>Form Field</div>
<div>Form Field</div>
<div>Form Field</div>
<div class="column row">
<h2>Column within column</h2>
<div>Form Field</div>
<div>Form Field</div>
<div>Form Field</div>
</div>
<div>Form Field "Y" Added</div>
</div>
<div class="column">
<h1>Column 2 layout goes here</h1>
<div>Form Field</div>
<div>Form Field</div>
<div>Form Field</div>
<div>Form Field Should Track with Form Field "Y" but How?</div>
</div>
</div>