Ask coding questions

← Back to all posts
How do you insert an image in html? (or replit)
daCynicalbOi

I used the <img> function and I tried to add an image, but it didn't work. The picture emoji came out, where it was supposed to be displaying my image. Please help. I am better at python, but I wanted to design a website so I had to use HTML.

Voters
daCynicalbOi
Comments
hotnewtop
AmoghTheCool

Ummm you have to add the src attribute

daCynicalbOi

@AmoghTheCool Thanks, that wasn't the problem. I had the src attribute from the beginning. The image link was not a webg link, and it was a file from my computer. I just converted the png into a webg link, and it worked fine. Thanks though.

MrVoo

@daCynicalbOi Both src and alt are required for an image

daCynicalbOi

@MrVoo nah it works fine without alt, I already proved it

AmoghTheCool

@MrVoo alt is not required, though it is a good practice (I believe alt is read by Screen Reading software since it cannot just "say" an image)

MrVoo

@daCynicalbOi If you say so, but it won't work for me without alt

MrVoo

@MrVoo Can you give the repl link, or the line of code with the image tag? Unless it works now...