通过github部署后,我的网站中的背景图像不可见

发布于 2025-01-22 00:28:56 字数 351 浏览 0 评论 0 原文

我已经查看了有关此问题的其他一些资源,但是由于某种原因,它们似乎没有起作用。我已经检查了图像的路径目录之类的内容,我认为这是正确的。我什至上传了PNG以及JPG来解决此问题,但这仍然没有任何区别。另外,它似乎与我的本地服务器完全可以正常工作,但与GitHub不合适。 这是我在GitHub页面上网站回购的链接: https://github.com/anushkakhare786/coffee-shop-.git-.git-.git-.git-.git

I've looked at some other resources regarding this problem, but for some reason, they don't seem to be working. I've checked things like the path directory for the image, and I think that it's correct. I even uploaded the png as well as jpg to resolve this, but it still didn't make any difference. Also, it seems to be working completely fine with my local server but just not with Github.
Here's a link to my repo for the website on Github pages:
https://github.com/AnushkaKhare786/Coffee-Shop-.git

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

意中人 2025-01-29 00:28:56

您的Web文件可能无法正确放置在GitHub上。 在这里是文档,它显示了您在Github上的步骤,我相信您想在Github上进行主机做

It is possible the your web files are not correctly placed on Github. Here is document that shows you steps on how to host on Github, which I believe you want to do

飘过的浮云 2025-01-29 00:28:56

我认为您应该尝试将图像在图像文件夹中分开。另外,尝试将CS​​S文件夹中的自定义样式表分开,然后在您的index.html中更新SRC,然后在GitHub上再次制作新的存储库。我认为我的建议会帮助您。

如果这不起作用,那么我的朋友请参考此链接并仔细阅读所有说明 - github页面指南

I think you should try to separate your images in an Images folder. Also, try to separate the custom stylesheets inside a CSS folder then update the src in your index.html then again make a new repo on Github. I think my advice will help you.

In case this didn't work then my friend refer to this link and read all the instructions carefully - Github Pages Guide

月棠 2025-01-29 00:28:56

您只需要更改cshop3.jpg的路径即可。为此,替换URL('/cshop3.jpg');在您的styles.css中的第213行中,由URL('./ cshop3.jpg')

- url('/cshop3.jpg');
+ url('./cshop3.jpg'); <- Add the "." before the slash, or remove the slash

添加“”。在斜线之前,或删除斜线以进入良好目录(您完成了/cshop3.jpg,请参考网站的根部,因此 https://anushkakhare786.github.io/ 而不是

You just need to change the path of cshop3.jpg. To do so, replace the url('/cshop3.jpg'); at line 213 in your styles.css by url('./cshop3.jpg')

- url('/cshop3.jpg');
+ url('./cshop3.jpg'); <- Add the "." before the slash, or remove the slash

Add the "." before the slash, or remove the slash to get to the good directory (You did /cshop3.jpg, that refer to the root of your site, so https://anushkakhare786.github.io/ and not https://anushkakhare786.github.io/Coffee-Shop-/

不顾 2025-01-29 00:28:56

将您的style.css文件配置更改为..
将您的图像路径更改为('./cshop3.jpg')

change your style.css file config to..
change your image path to ('./cshop3.jpg')

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文