如何使用本地文件作为背景图片url
How to use local file as background image url
我应该更改什么以将本地 link 插入到 C:\xampp\htdocs\Folder
而不是 https://source.unsplash.com/1600x1050/?nature
。
我正在使用 Bootstrap 4,这是我的 css
.jumbotron{
background:
linear-gradient(
rgba(0, 0, 250, 0.25),
rgba(125, 250, 250, 0.45)
),
url(https://source.unsplash.com/1600x1050/?nature);
background-repeat: no-repeat;
background-attachment: fixed;
color:white !important;
}
提前致谢
我猜 C:\xampp\htdocs\
是您网站的根目录,这意味着 URL /
在您的 HTML、CSS 和 JavaScript 个文件可能会指向 C:\xampp\htdocs\
。如果是这样,URL /Folder/pic.jpg
可能只适合您,因为它会在内部转换为文件 C:\xampp\htdocs\Folder\pic.jpg
.
.jumbotron{
background:
linear-gradient(
rgba(0, 0, 250, 0.25),
rgba(125, 250, 250, 0.45)
),
url("/Folder/pic.jpg");
background-repeat: no-repeat;
background-attachment: fixed;
color:white !important;
}
我应该更改什么以将本地 link 插入到 C:\xampp\htdocs\Folder
而不是 https://source.unsplash.com/1600x1050/?nature
。
我正在使用 Bootstrap 4,这是我的 css
.jumbotron{
background:
linear-gradient(
rgba(0, 0, 250, 0.25),
rgba(125, 250, 250, 0.45)
),
url(https://source.unsplash.com/1600x1050/?nature);
background-repeat: no-repeat;
background-attachment: fixed;
color:white !important;
}
提前致谢
我猜 C:\xampp\htdocs\
是您网站的根目录,这意味着 URL /
在您的 HTML、CSS 和 JavaScript 个文件可能会指向 C:\xampp\htdocs\
。如果是这样,URL /Folder/pic.jpg
可能只适合您,因为它会在内部转换为文件 C:\xampp\htdocs\Folder\pic.jpg
.
.jumbotron{
background:
linear-gradient(
rgba(0, 0, 250, 0.25),
rgba(125, 250, 250, 0.45)
),
url("/Folder/pic.jpg");
background-repeat: no-repeat;
background-attachment: fixed;
color:white !important;
}