React JS responsive height and width

962 Views Asked by At

How can I make the height and width of a div grow and shrink with their aspect ratio while resizing the window?. I'm using tailwind css with next JS and I want to make my div responsive while resizing the window, and in doing that I need the height to shrink as well. how is that possible?

<div className="relative flex -z-10 h-auto w-72 object-scale-down">
          <Image src={"/profile.webp"} fill objectFit="cover" />
        </div>

I'm using an image as a content for the div.

0

There are 0 best solutions below