I'm trying to use the Next.js' <Image>
component with the layout=fill
option. Therefore I've created a relative
div
that contains the Image
tag. But I'd like to determine the height by the Image height.
Found this example but height is statically given there. So I've tried this based on the example.
<div className="relative w-full h-full">
<Image
src={post.coverImage.url}
layout="fill"
alt={post.title}
/>
</div>
I've also tried h-full
or max-h-full
classes instead of h-
tags but couldn't succeed.
How can I make its height automatically determined?