【发布时间】:2020-08-10 06:46:20
【问题描述】:
所以我想要改变浏览器的大小并将背景的 img 保持为 100% 的宽度和高度以及 div 的内部,这是图像:
在需要的时候改变它的比例,这样它就不会像这样被拉伸:
- 页面压缩时的图像:https://github.com/MestreALMO/NextLevelWeek2020Day06Plus/blob/master/_ReadmeImgs/searchingForThisEffect/Screenshot_3.2.png?raw=true
- 页面拉伸时的图像: https://github.com/MestreALMO/NextLevelWeek2020Day06Plus/blob/master/_ReadmeImgs/searchingForThisEffect/Screenshot_3.3.png?raw=true
这是我的代码的一部分:
var backgroundLoginContainer01 = {
backgroundImage: `url(${Background})`
}
那我这样称呼它:
<div style={backgroundLoginContainer01} />
【问题讨论】:
-
使用 backgroundSize: 覆盖
-
我没有得到它,我如何将它插入到sn-p中?