如何在托管提供商的 ASP.NET-MVC 中引用我的 CSS 中的图像

发布于 2024-09-26 09:09:56 字数 324 浏览 0 评论 0原文

我的 site.css 文件(在 COtent 目录中)中有这个,

body { width: 100%; background: #e7e6de url("/content/images/back-page1.png") repeat-x; font: normal 13px arial, sans-serif; text-align: center; color: #4c4c4c; }

当我在本地测试它时它工作正常,但当我将网站上传到托管提供商时它不起作用。

问题出在背景图片的网址上。我认为它有一些路径问题。

有什么建议吗?

i have this inside my site.css file (in the COntent directory)

body { width: 100%; background: #e7e6de url("/content/images/back-page1.png") repeat-x; font: normal 13px arial, sans-serif; text-align: center; color: #4c4c4c; }

it works fine when i test it locally but it doesn't work when i upload the site to the hosting provider.

the issue is around the url of the background image. i assume its some path issue.

any suggestions?

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

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

发布评论

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

评论(1

有深☉意 2024-10-03 09:09:56

您需要使 URL 相对于 css 文件。

如果您的 css 文件位于 content/style

,那么您的 url 应为 ../image/back-page1.png

You need to make the URL relative to the css file.

If your css file is located under content/style

Then your url should be ../image/back-page1.png

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