【发布时间】:2022-02-08 19:19:37
【问题描述】:
如下图所示,女孩和狗并没有完全显示出来:
是否有任何 css 属性可以完全将图像作为背景?还是我必须调整图像大小?
这是我的 CSS:
*{
margin: 0;
padding: 0;
}
body{
background-image: url('../public/images/bg0.jpg');
height: 100vh;
background-repeat: no-repeat;
background-size: cover;
object-fit: contain;
transition: background-image 1.5s linear;
}
#__next{
height: 100%;
}
【问题讨论】:
-
既然您已将其标记为next.js,您是否使用
next/image组件来渲染图像?如果是这样,您能否也提供该代码?