Solution 1 :

Unclear of final design, but you might try this:

      function abc() {
        const sel = document.querySelector(".content");
        sel.style.height = "300px";
        sel.style.position = 'absolute';
        sel.style.bottom = '0px';
      }

Solution 2 :

You can use the transform: scaleY(val) and transform-origin: bottom to resize and from where your element.

 .abc {
        width: 80%;
        margin: auto;
        display: grid;
        grid-template-columns: repeat(10, [col-start] 1fr);
        grid-template-rows: repeat(8, [row-start] 1fr);
        padding-top: 3.4em;
        padding-bottom: 3.4em;
      }
      .img {
        grid-column: col-start / span 8;
        grid-row: row-start / span 6;
        background-size: cover;
        max-width: 1074px;
        max-height: 200px;
        background-color: #ee0;
      }
      .content {
        grid-column: col-start 6 / span 6;
        grid-row: row-start 2 / span 6;
        background: #fff;
        min-height: 100px;
        border: 1px solid blue;
        padding: 3em;
      }
      
      .bigger {
      transform: scaleY(2);
      transform-origin:bottom;
      }
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Static Template</title>
    <style>
     
    </style>
  </head>
  <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").classList.add('bigger');
      }
    </script>
  </body>
</html>

Solution 3 :

Another version:

<!DOCTYPE html><html lang="en"><head>
<meta charset="UTF-8">

<meta name="viewport" content="width=device-width,initial-scale=1.0, user-scalable=yes"/>

<title> Test Page </title>
<!-- link rel="stylesheet" href="common.css" media="screen" -->
<!-- From: https://stackoverflow.com/questions/69050335/how-to-increase-height-of-div-from-top-not-from-bottom/69050592#69050592 -->
<style>
 .content { background-color: pink; width: 10em; }
 .asterisk { height: 300px; }
</style>

</head><body>
   <div class="parent">
      <div class="abc">
        <div class="img">Image</div>
        <div class="content">Content</div>
      </div>
    </div>
    <button onclick="abc()">click</button>

<script>
  function abc() {
    const sel = document.querySelector(".content");

    var div = document.createElement('div');
//    div.innerHTML = '*';
    div.className = 'asterisk';

    sel.parentNode.insertBefore(div, sel);
  }
</script>
</body></html>

Problem :

I am trying to increase height of div on button click. I am facing an issue my div is increase from bottom (default behaviour). But I want my div bottom with remain contain. It show from top.

In my example I have two div yellow and white. On button click, I am increasing the height of white box. But it is increase from down direction. I need it grows from top.

Here is my code:

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>

Comments

Comment posted by Paulie_D

You have to find a way to “pin” the div in position at its bottom then it will grow as you want.

By