hello everyone, can you tell me how to insert an image? <img src="image.jpg" alt="" /> I use this syntax but it doesn't work. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

hello everyone, can you tell me how to insert an image? <img src="image.jpg" alt="" /> I use this syntax but it doesn't work.

8th Oct 2017, 2:15 PM
Nawid Nazari
Nawid Nazari - avatar
6 Answers
+ 4
The easiest way to get the url of the file is to drag and drop the image file onto a web browser, then you can see the file url in the address bar. Sorry mate, I was doing something, I couldn't respond earlier :)
8th Oct 2017, 5:43 PM
Ipang
+ 3
@Nawid Nazari, in this case, make sure the image file is located on the same path with your HTML file, because otherwise you'd need to specify the path to the file rather than just the filename. If it's a remote resource, e.g. a file on Google drive or free image hosting service make sure the url is correct, paste the url on browser address bar to test if the url is valid/accessible. Hth, cmiiw
8th Oct 2017, 2:40 PM
Ipang
+ 3
- What is your desktop Operating system, Windows, Linux, or Mac? - What application/program do you use to edit your HTML file? - Can you post your code here so others can see where the problem is? You can use relative path to refer to the image, let's say we have this directory structure: /web/html/yourfile.htm /web/images/img1.png You can refer to the img1.png file from your yourfile.htm like this: <img src="../images/img1.png" alt="Sample image" /> Hth, cmiiw
8th Oct 2017, 6:45 PM
Ipang
+ 1
it's still not working, don't know what to do.
8th Oct 2017, 6:07 PM
Nawid Nazari
Nawid Nazari - avatar
0
The image is located on the desktop, how can I find the url of the image?
8th Oct 2017, 3:40 PM
Nawid Nazari
Nawid Nazari - avatar
0
Thank you dear Ipang
9th Oct 2017, 3:33 AM
Nawid Nazari
Nawid Nazari - avatar