取消启动后台 URL 不起作用



所以我在我的html页面中使用unsplash来制作一些图像。每当我包含后台网址时,我都不会在我的 html 页面中看到它。我正在接收来自 https://unsplash.com/

的图像我

只是找到一张图片右键单击复制图像网址并将其粘贴到我的身体背景网址中,但我没有看到任何图像背景,我做错了什么?

body {
    background: url(https://unsplash.com/?photo=vZlTg_McCDo);
    background-size: cover;
}

#content {
    text-align: center;
    padding-top: 25%;
}

使用背景图像:而不是背景:

根据他们的 API 文档,您的图像 URL 应采用以下语法

https://source.unsplash.com/{PHOTO ID}/{WIDTHxHEIGHT}

这是您问题中代码的修改形式

body {
    background: url(https://source.unsplash.com/vZlTg_McCDo/1600x900);
    background-size: cover;
}
#content {
    text-align: center;
    padding-top: 25%;
}

最新更新