Ask coding questions

← Back to all posts
how I can put an image on a html project?
SimoneEnoletto (0)

I know I have to do imp src= but it doesn't work

Comments
hotnewtop
SreyasSabbani (62)

You can also do

  1. Create CSS & HTML File
  2. Create a Class in the CSS file
  3. Add the background image you want
.sam-splint {
  background-image: url("/types-splint.png");
  width: 242px;
  height: 500px;
}
  1. Create a <div> and give it the CSS class you want

If this is answer, please mark this as answer!

SimoneEnoletto (0)

thanks at all the guys that helped me!

codingjlu (215)

If you have a link to your image:

In you html:

<img src="https://linktoyourpicture.com/pic.png"></img>

If not

Drag and drop your picture into your repl, then:

<img src="yourImageName.png"></img>
BananaJellyfish (210)

You have to do:
<img src="image_name_here.jpg">
Also i think you uave to have the image downloaded as a file. When youre in your project, on the left you can press the 3 dots then 'upload file', like so:

notGilbert (121)
  1. make sure the img tag is inside an element that is being displayed: <body>
  2. make sure the img URL is valid (if you open it, it should be an image with a black background)
  3. make sure the HTML code is correct:
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/45/Eopsaltria_australis_-_Mogo_Campground.jpg/800px-Eopsaltria_australis_-_Mogo_Campground.jpg">