I'm currently trying to increase the height of a div on button click. However, I am encountering an issue where the div is expanding from the bottom (default behavior). What I actually want is for the div to expand from the top while keeping its content intact.
In my scenario, I have two colored divs - yellow and white. When the button is clicked, I want the height of the white box to increase from the top rather than the bottom.
Check out the code here:
https://codesandbox.io/s/still-lake-lw07u?file=/index.html
<body>
<div class="parent">
<div class="abc">
<div class="img"></div>
<div class="content"></div>
</div>
</div>
<button onclick="abc()">click</button>
<script>
function abc() {
document.querySelector(".content").style.height = "300px";
}
</script>
</body>