+ 1
Do I need to connect my PC to the internet for an image tag <img> to display the picture on a chrome browser?
<body> <img src="preco.jpg" width="100" height="100"> </body> Please note : The picture file is in the same folder with the .html file.
12 Antworten
+ 1
NWUCHOLA OWEH PASCAL open the console in Chrome and post here the error that is showed. To open the dedicated Console panel, either:
Press Ctrl+Shift+J (Windows / Linux) or Cmd+Opt+J (Mac).
+ 1
No, if your project is on the local PC you dont need to connect to internet
0
@ Pietro thanks for your prompt response. I'm still getting a thumbnail as the image after running the code
0
Failed to load resource: net: : ERR_FILE_NOT_FOUND. precohh.jpg:1
0
Is precohh.jpg the correct name of the image?
0
Yes it is, and I've copied the image file to the same folder where the .html file is located
0
Ok try changing the src from src="file_name.jpg" to src="./file_name.jpg"
0
Thanks a lot Pietro. I just figured out the error
0
Which was?
0
The preco image file is actually not a jpg file. It has windows player icon on it. so I tried another image that's in jpg format, and it worked.
0
Ok so the problem was the file name. Anyway use the console to debug your code when something doesn't work. Byee
0
Yeah! Sure I'll. Thanks once again