You can use Flexbox. With justify-content: flex-endand, you can move the contents to the end of the parent element , so if you want to put another child on top of the parent, you can use margin-bottom: auto. This applies if you are setting flex-direction: columnfor the parent.
.content {
min-height: 100vh;
display: flex;
flex-direction: column;
justify-content: flex-end;
}
.main {
margin-bottom: auto;
border: 1px solid black;
}
.box {
background: lightblue;
margin: 5px;
}
<div class="content">
<div class="main">Lorem ipsum dolor.</div>
<div class="box">One</div>
<div class="box">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Obcaecati vel molestiae dolores, ad, nulla harum tenetur minima aperiam debitis id atque fugit, modi error et magni eius repellendus saepe. Vero?</div>
</div>
Run codeHide result source
share