I have two divs on my page; sidebar and main panel.
In the sidebar, I will always have a bunch of content blocks, a number with a change all the time. And the main panel will have some content block. As a rule, the side panel will have a greater height than the main panel.
I am looking for the height of the main panel to be equal to the contents of this panel, and I am looking for a way to increase the height of the side panel to the size of the main panel. While the overflow sidebar scrolls. I do not want to set a static height for any of them, as the amount of content changes.
I am currently using a grid, but all for changing it, if there is a way to do this.
Here is the Codepen layout of what I have now:
https://codepen.io/aculbreth/full/VMjRyx
.box {
display: grid;
grid-template-columns: 1fr 4fr;
grid-gap: 20px;
grid-auto-columns: max-content;
background: #efefea;
margin: 50px auto;
padding: 20px;
box-sizing: border-box;
.side_panel {
background:#fff;
padding:20px;
box-sizing: border-box;
.side_panel_box {
text-align:center;
border: 1px solid #000;
margin-bottom:20px;
}
}
.main_panel {
background:#fff;
padding:20px;
box-sizing: border-box;
display:block;
grid-auto-columns: max-content;
}
}
Here is a rough layout of what I'm looking for:

source
share