Ask coding questions

← Back to all posts
How do you insert a photo in HTML, CSS, JS
NZHacker808 (106)

I need to insert a photo in HTML, what do I code to insert a photo?

Answered by Highwayman (1443) [earned 5 cycles]
View Answer
Comments
hotnewtop
Highwayman (1443)

<img src="LINK">ALTERNATIVE_TEXT</img> where LINK is a url or path to the photo and ALTERNATIVE_TEXT is the text that should be displayed instead if for some reason the img can’t be displayed.

NZHacker808 (106)

I'll give you more cycles!

NZHacker808 (106)

You are always here while I'm here :)

Highwayman (1443)

@Miner36number2 you just forgot to put the .png at the end. So it’d be <img src="RIS.png"></img> not <img src="RIS"></img>

NZHacker808 (106)

@Highwayman Can you please tell me if you can convert an image which I created into an URL or straight into my HTML? Thank you

Highwayman (1443)

@Miner36number2 does storing it in your repl not work?

NZHacker808 (106)

Because I created it

NZHacker808 (106)

@Highwayman What if the picture doesn't have a URL?

Highwayman (1443)

@Miner36number2 then you can download it onto your repl

And refer to it using a normal relative or absolute link like with css or js files.

NZHacker808 (106)

I've never put the photo in a HTML before, so I forgot

RababRahman (0)

I only know html:
<img src=.....>

NZHacker808 (106)

@Highwayman Can you smaller the size of the image?

Highwayman (1443)

@Miner36number2 yes, just use the width and height attrs.