leora
leora

Reputation: 196539

how do i reference an image from my css in asp.net-mvc on a hosting provider

i have this inside my site.css file (in the COntent directory)

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

it works fine when i test it locally but it doesn't work when i upload the site to the hosting provider.

the issue is around the url of the background image. i assume its some path issue.

any suggestions?

Upvotes: 0

Views: 688

Answers (1)

John Hartsock
John Hartsock

Reputation: 86882

You need to make the URL relative to the css file.

If your css file is located under content/style

Then your url should be ../image/back-page1.png

Upvotes: 3

Related Questions