【发布时间】:2021-09-14 23:02:37
【问题描述】:
所以,我有一个容器 div 和一个 Image 组件。我希望图像高度等于容器高度的 100%,并且容器的宽度根据图像的宽高比自动决定。当我使用普通的img 标签时,这没有问题,但在下一个Image 组件的情况下,图像的宽度为0px。因为它要我为容器定义一个固定的宽度。 ?我怎样才能达到我想要的?
我正在做的是这样的:
对于 div:
div {
height: 50px;
width: auto;
}
对于图像组件:
<Image src="..." alt="..." layout="fill" />
【问题讨论】:
标签: css image next.js image-resizing next-images