2016-11-08 161 views
0

后,我有一个CSS参考,定义为...CSS参考失败部署

td.details-control { 
    background: url('../../Content/plugins/dataTables/details_open.png') 
      no-repeat center center; 
      cursor: pointer; 
} 

的实际路径,在本地,对PNG,是...

http://localhost:59328/Content/plugins/dataTables/details_open.png 

的问题是,当我把它因此部署到生产服务器的路径是现在....

http://test.myproductionserver.com/PrimaryDomain/Content/plugins/dataTables/details_open.png 

,你可以看到“/ PRIMARYDOMAIN /”引起了我的问题与png参考。我怎样才能解决这个问题?

我试图使巴新路径,这一点,但它不工作...

'~/Content/plugins/dataTables/details_open.png' 
+0

是在同一文件夹 – Geeky

+0

看着我使用图书馆你的CSS文件,在CSS中引用是相对的CSS文件,即CSS文件位于content/css中,并具有“background-image:url('Black/sprite.png');”无论我在哪里部署,图像都可以在content/css/Black中成功找到。 –

+0

@Geeky不,它不是。 – WebDevGuy2

回答

0

不是写绝对路径的解决方案?

background: url('/Content/plugins/dataTables/details_open.png') 

这样,您将获得:

http://test.myproductionserver.com/Content/plugins/dataTables/details_open.png 
+0

这似乎并不奏效。此错误:http://test.myproductionserver.com/Content/plugins/dataTables/details_open.png ...无法加载资源:服务器的状态为404(未找到)回应....它缺少“/ PRIMARYDOMAIN /”。 – WebDevGuy2