3

我有一个托管在 IIS 中的应用程序

在此处输入图像描述

但不能使用 CSS 文件中的背景图像

css 从布局中引用:

<link href="@Url.Content("~/Content/themes/NewStyleSUPERADMIN/style.css")" rel="stylesheet" type="text/css" />

style.css中,我有:

background-image: url('/content/themes/NewStyleMeduimHarder/images/Bottom_texture.jpg');

或者

background-image: url('/content/themes/NewStyleMeduimHarder/images/Bottom_texture.jpg');

如何显示图像?

4

3 回答 3

7

使用相对路径。部分urls相对于样式表被解析

background-image: url(images/Bottom_texture.jpg);
于 2012-10-25T18:49:36.517 回答
1

在CSS中你应该只使用url(../images/Bottom_texture.jpg)

据我所知,您还应该将 url 更改为 css@Url.Content("~/Content/themes/NewStyleSUPERADMIN/style.css")

于 2012-10-25T18:51:14.147 回答
0

网址应该是

url(themes/NewStyleMeduimHarder/images/Bottom_texture.jpg) 

关于内容文件夹。

于 2012-10-26T04:20:03.263 回答