How do i add img | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do i add img

Guys I created the krishna janmashtami code but the photo not available https://code.sololearn.com/WuaG7PtsOn2E/?ref=app

6th Sep 2023, 4:18 PM
Asha Goyal
Asha Goyal - avatar
8 Answers
+ 1
You have to provide a link in the src attribute. For example https://biografieonline.it/img/bio/k/Krishna.jpg. P.S Put all your js code in window.onload=function(){} and it will work on mobile too.
6th Sep 2023, 4:53 PM
Luca Corvino
Luca Corvino - avatar
+ 6
Your on the right track. If your html file and image were in the same location then your code would work. But since it is not, you should use an 'absolute URL' which includes the full path to the image on the web. Like this (example only): <img src="https://some-website/images/some-image-name.jpg">
6th Sep 2023, 4:52 PM
Keith
Keith - avatar
+ 4
If your image krishna.jpg is located on your local device, then the sololearn web environment has no access to it. You should store the image on a onedrive account and insert the link to the image in the html.
6th Sep 2023, 4:52 PM
Jan Markus
+ 1
Glad Ekong I edited and maked it right
8th Sep 2023, 3:50 PM
Asha Goyal
Asha Goyal - avatar
0
Ok thank u all
6th Sep 2023, 5:48 PM
Asha Goyal
Asha Goyal - avatar
0
<img src = "url">
6th Sep 2023, 8:39 PM
Fabian Roy
Fabian Roy - avatar
0
<img src = "url">
7th Sep 2023, 2:23 PM
Sultan Usman Adam
Sultan Usman Adam - avatar
0
I can see the image pretty well.
7th Sep 2023, 10:17 PM
Glad Ekong
Glad Ekong - avatar