Images issue when deployed using publish

I am using MVC 3.0 and my images work fine when I run from Visual Studio IDE. But when I publish to a file system, my images are not being displayed. Here is the snippet of code that doesnt work when published, but otherwise works fine.

.red_plus {float:left;padding-left:18px;color:#D82A26;background:url('/img/gll-red-plus.gif') 0 50% no-repeat;cursor:pointer;}



<span id="toggle_rates_summary" class="red_plus" onclick="SomeFunctionName('SomeParam'); return false">View Something</span>

Can anyone tell me what is going on?? Below is the folder structure of my project.

WebProjectName -Content -css -main.css -Image -gll-red-plus.gif

Answers


Image urls that you set in your CSS files should be relative to the location of the CSS file. So for example if you have the following folder structure:

|- Styles - main.css
|- img - gll-red-plus.gif
|- Views - ...
|- Content - ...

inside your main.css:

.red_plus {
    float:left;
    padding-left:18px; 
    color:#D82A26;
    background:url('../img/gll-red-plus.gif') 0 50% no-repeat;
    cursor:pointer;
}

Need Your Help

c++ code to sort text file doesn't works

c++ sorting csv order

A friend left me a code that should open 2 files solution.txt and priority.csv and generate a 3rd file result.txt as an output.

Select data from table B where a field in table B matches table A (php mySQL)

php mysql

I have a table which contains a list of livestock ("livestock"), this gets regularly updated and changed. I also have a second table ("description") containing two columns "Scientific" and "Descrip...