JSFiddle - React, Tailwind, and code Playground

HTML

<div style="margin-top: 500px">

</div>
<div class="container">
  <div class="transform">TRANSFORM</div>
  <div class="div1">
    <img src="https://via.placeholder.com/500">
  </div>
  <div class="div2">
    <span>TEXT</span>
  </div>
</div>

CSS

.transform {
  background-color: slategray;

}

.transform:hover~.div1 {
  max-height: 0;
}

.transform:hover~.div1 img {
  max-height: 0;
}

.div1 {
  max-height: 600px;
  background-color: royalblue;
  padding: 15px;
  transition: max-height 0.5s;
}

.div2 {
  background-color: springgreen;
  font-size: 20px;
}

img {
 max-height: 200px;
 transition: max-height 0.6s;
}