I am in the process of creating a basic HTML page with two sections, each containing content. However, the last content within the second .right
div is extending to the bottom of the page, causing it to become scrollable.
I attempted to create another div with flex-direction: column
, but this approach did not resolve the issue:
body {
margin: 0;
}
.main-container {
display: flex;
flex-direction: column;
}
.left {
background: #ecece9;
width: 50%;
height: 100vh;
}
.right {
background: #ffffff;
width: 50%;
height: 100vh;
}
<div class="main-container">
<div class="left">
<h2>content</h2>
</div>
<div class="right">
<h2>content should be on top</h2>
</div>
</div>
Is there a way to position two <div> elements next to each other with equal width and height without causing scrolling?