In the markup below, these left and right flexbox containers are scrollable so that users can compare details.
I need would like a way of being able to have the child elements at the same index have the same height even though their content is different.
For example, the 2 address divs should have the same height.
I can do this with javascript but is it possible with just css?
* {
box-sizing: border-box;
}
div,
main {
border: 1px solid red;
}
body {
display: flex;
flex-direction: column;
margin: 0;
height: 100vh;
}
main {
height: 100%;
flex: 1 1 0;
display: flex;
}
.row {
display: flex;
flex: 1;
}
.col {
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0;
display: flex;
}
.container {
display: flex;
flex: 1;
}
.container {
display: flex;
}
.container .left,
.container .right {
flex: 1;
height: 100%;
overflow: auto;
}
main .row:first-child {
height: 100%;
}
<html>
<body>
<header>Header</header>
<main>
<div class="row">
<div class="col container">
<div class="left">
<div class="name">
<strong>Name</strong> BoB Smith</div>
<div class="address">
<strong>Address</strong>
<p>21</p>
<p>Somewhere Street</p>
<p>Somewhere City</p>
<p>That Country</p>
<P>BWERE EREWW</P>
</div>
<div>
<strong>Something else</strong>
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
<li>Four</li>
<li>Five</li>
<li>Six</li>
<li>Seven</li>
<li>Eight</li>
<li>Nine</li>
<li>Ten</li>
</ul>
</div>
</div>
<div class="right">
<div class="name">
<strong>Name</strong> BoB Smith</div>
<div class="address">
<strong>Address</strong>
<p>21</p>
<p>Somewhere Street</p>
</div>
<div>
<strong>Something else</strong>
<ul>
<li>One</li>
</ul>
</div>
</div>
</div>
</div>
</main>
</body>
</html>