kalu
kalu

Reputation: 337

Reference background-image in CSS - application MVC 3 ASP.NET in IIS

I have an application hosted in IIS

enter image description here

But not working the background-image from CSS file

The css is referenced from the layout with:

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

in the style.css, I have:

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

or

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

How do I display the image?

Upvotes: 3

Views: 4200

Answers (3)

amesh
amesh

Reputation: 1329

The url should be

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

With respect to the Content folder.

Upvotes: 0

Caelea
Caelea

Reputation: 2348

In the css you should only use url(../images/Bottom_texture.jpg)

And as far as I can see you should also change the url to the css to @Url.Content("~/Content/themes/NewStyleSUPERADMIN/style.css")

Upvotes: 1

steveax
steveax

Reputation: 17743

Use a relative path. Partial urls are resolved relative to the style sheet:

background-image: url(images/Bottom_texture.jpg);

Upvotes: 7

Related Questions