Background image not showing in asp.net project

asp net images not displaying in browser
how to set background image in cshtml
mvc background-image not working
how to display image in asp net using c#
how to display image from path in asp net mvc 5 and razor view
asp net add image
asp net render image
how to insert image in asp net mvc

I have created ASP.NET project in my office computer and synchronized it using Google Drive, so that I can open the same project in my home.

Both my office computer and home computer have the same resources.

I have executed the same project in my home computer, the background image of the web page not displayed.

Below is the css code I used to display the background image

body { 
    background-image: url('/Images/blue.jpg');
}

Also I have tried,

body { 
    background-image: url('../Images/blue.jpg');
    background-image: url('~/Images/blue.jpg');
}

I don't know what causes the problem while opening ASP.NET projects on different machines.

Try by giving the full path for the image

eg:

body { 
background: url('http://www.australia.com/contentimages/about-landscapes-nature.jpg');
}

If it is working, then the problem is with your path, so you have to correct it.

To correct the path:

1) Take the image out of the folder put it in the folder in which stylesheet lies

2) Give style as background-image: url('blue.jpg');

CSS Background-Image refuses to display in ASP.Net MVC, The url inside a CSS file is relative to the location of the CSS file. So if we suppose that you have ~/content/foo.css and you want to include  The forums ran from 2008-2020 and are now closed and viewable here as an archive. This topic has 16 replies, 5 voices, and was last updated 4 weeks, 1 day ago by ajsaule. I have the background image saved in the images folder, obviously, as a jpeg. When I go to preview the HTML in Firefox, nothing is showing. What am I doing wrong?

I recently faced this problem. As the question states

background : url('../images/books.jpeg');

didn't work. However the following solved my problem.

background : url("../images/books.jpeg")

All I had to do was change ' into "

background-image not displaying properly, Hi, I am unable to display my CSS background-image in my web form with also​, make sure the folder name is imagmenu and not imagemenu. studio 2015\​Projects\WebApplication12\WebApplication12\website-design-  Add four images to the images folder you just created. (Any images you have handy will do, but they should fit onto a page.) Rename the images Photo1.jpg, Photo2.jpg, Photo3.jpg, and Photo4.jpg. (You won't use Photo4.jpg in this procedure, but you'll use it later in the article.) Verify that the four images are not marked as read-only.

Can you please provide directory structure? Because there must be something going wrong, something must be different on the two machines.

Generally, URLs in the CSS must contain either a full absolute URL, or URLs relative to the CSS file (not the HTML, or in this case, the .aspx file).

You may try an abolute path, at least for testing purposes, to further confirm that there is a path issue there.

Background image not displaying, please help, Hi Sir, Please help me on setting the background image on my asp.net application. The background image is not displaying, the image and my  When debugging the minified code, the line numbers do not refer to the orignal files. The file that has the .map extension, which is also called as source map file fixes this problem by allowing the Web debuggers to refer to the original context from where the code was generated.

Background image not showing in asp.net project - asp.net - html, Images/blue.jpg'); background-image: url('~/Images/blue.jpg'); } I don't know what causes the problem while opening ASP.NET projects on different machines. When images are inserted in Kompozer from other directories/folders, the references to the images (url addresses) may be absolute. This means that additional folder have to be published along with

Problem With Background Image Not Showing At Runtime, I had my background image in the style page and I am not sure if I changed something on the master page but when I tried to change the 

DIV CSS background-image does not display, You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of 

Comments
  • hv u tried to access ur app from other machine within your office...if it works or not. Moreover your image should be accessible like domain/Images/blue.jpg
  • yes, whenever I try to execute the project in different machines, the problem occurs.
  • Full path is working, but I need to work on same project on different machines. How to solve the path problem?
  • @MohamedMatheen I have made some edits to my answer, see it works or not.
  • If it is directory structure problem, how do I have to solve it?