I want to create a layout where a .parent
div has two children, .left
and .right
, both taking up equal halves of the entire width and stacked side by side. The height of the .parent
should be the same as the .left
child, while the .right
child should have the same height as the .left
. Here's an example image:
The yellow box wrapping the two containers is .parent
, which has its content-box height (i.e., without padding, border, margin) equal to .left
. The red box at the left has the height as minimum as possible to wrap the content. The pink box at the right has scrollbars to manage exceeding content.
I've tried using flex
and grid
to create this layout, but I was unsuccessful. Can someone please help me code or explain how I can achieve this layout? Thank you.