如何在托管提供商的 ASP.NET-MVC 中引用我的 CSS 中的图像
我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使 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