Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在宿主提供商上引用asp.net-mvc中css中的图像_Css_Asp.net Mvc_Path - Fatal编程技术网

如何在宿主提供商上引用asp.net-mvc中css中的图像

如何在宿主提供商上引用asp.net-mvc中css中的图像,css,asp.net-mvc,path,Css,Asp.net Mvc,Path,我在我的site.css文件(在COntent目录中)中有这个 当我在本地测试它时,它工作得很好,但当我将站点上传到托管提供商时,它就不工作了 问题在于背景图像的url。我认为这是一个路径问题 有什么建议吗?您需要使URL相对于css文件 如果您的css文件位于content/style 然后您的url应该是。/image/back-page1.png您需要使url相对于css文件 如果您的css文件位于content/style 那么你的url应该是。/image/back-page1.png

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

当我在本地测试它时,它工作得很好,但当我将站点上传到托管提供商时,它就不工作了

问题在于背景图像的url。我认为这是一个路径问题


有什么建议吗?

您需要使URL相对于css文件

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


然后您的url应该是
。/image/back-page1.png

您需要使url相对于css文件

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

那么你的url应该是
。/image/back-page1.png

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