3

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?

3 Answers 3

7

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

background-image: url(images/Bottom_texture.jpg);
Sign up to request clarification or add additional context in comments.

Comments

1

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")

1 Comment

This is the answer that worked for me. I put the images in a folder called "Images." Then I put in this: url("../Images/nameofpicture.gif")
0

The url should be

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

With respect to the Content folder.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.