Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
All my doc( html,css and image) are located in the same folder : C:\Users\hajar\Desktop\test01

My code is mentioned below.

I have checked the spelling of my image's name, another point that may be worth highlighting is that I am using VS to code, and I have noticed that when I click on the image link in VS , it won’t open instead I get this message : " an error occurred while loading the image"

Thank you in advance for your help.

What I have tried:

background-image: url('coverpage.jpg');
Posted
Updated 24-Aug-20 22:41pm
Comments
RedDk 7-Jun-20 17:33pm    
I'm just guessing here because what usually happens when saving HTML to the desktop or another folder (perhaps the website was "published" through VS, I don't know) the path is not absolute. Try including the complete path name along with the file. Experimenting in VS, particularly when jumping between DESIGN and SOURCE is the only way to go. Plus you've got an advantage when doing the manual arrangement of content through DESIGN. Just read the SOURCE that got "wizarded".
Richard Deeming 8-Jun-20 8:16am    
If VS displays an error when you try to open the image, are you absolutely sure it's really an image? If you can open it in an image editor, try saving it again to see if it's a problem with the image format.
W Balboos, GHB 12-Jun-20 8:01am    
Why not make your life a lot easier and use a simpler editor for your website - no inteference from VS and all of it's defaults and background handling.

I use Expression Web 4 - a now FREE Microsoft product. It understands (i.e., autocomplete) HTML, CSS, javaScrit, php . You save text files to the place you want to save them. If you create (or add) your files to a "website" in VS it handles searches and interconnected changes nicely.

It's simple. You get to know more of what you're doing.

1 solution

This happens to me too try this code:
background-image: url("image.png");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900