Sanjay Maharjan
Sanjay Maharjan

Reputation: 671

css image not showing

I am trying to load a image to the division below in asp.net mvc view. If I assign the background color in it it shows the color but image.

 <div class="pic">afssadf</div>

here is my css

.pic
{   
    background:url(Images\c.jpg) center top no-repeat;       
}

The image is not showing in the division. what is going wrong in above code;

Upvotes: 2

Views: 185

Answers (1)

Leniel Maccaferri
Leniel Maccaferri

Reputation: 102448

Try:

.pic
{   
    background:url(../Images/c.jpg) center top no-repeat;       
}

This generally happens because the path you specify in the url is wrong. One easy way to debug this is with Firebug in Firefox. Select the element that should have the image and try different URLs till you get the correct one.

Upvotes: 3

Related Questions