0

I'm trying to show an image on my website and am having way more trouble than I feel like I should. I've done this multiple times with no issue on other projects but for some reason its not working.

HTML: <img src="./reddit.png"/>

My image IS in the same folder as my html file.

What I've Tried

<img src="./reddit.png"/>

<img src="reddit.png"/>

<img src="../reddit.png"/>

<img src="D:project\src\components\reddit.png"/>

<img src="D:project/src/components/reddit.png"/>

I thought maybe it was an issue with the tag so I tried,

<img src="https://faroutmagazine.co.uk/static/uploads/2020/02/George-Harrison-Let-It-Be-768x464.jpg"/>

and that img showed up fine. I also tried moving the img to a images folder and making the path "/images/reddit.png" but that also didn't work.

(also I am in a js react component if that has an effect on the HTML)

Dave
  • 57
  • 1
  • 1
  • 7
  • Are you sure the image extension is the extension you loaded? Also, check if you have permission to the folder containing the images – Fritzdultimate Sep 01 '20 at 21:30
  • 3
    Does this answer your question? [Correct path for img on React.js](https://stackoverflow.com/questions/37644265/correct-path-for-img-on-react-js) – Redseb Sep 01 '20 at 21:42

1 Answers1

0

Try <img src="/src/components/reddit.png"/>, alternatively use the import keyword for relative paths:

import reddit from './reddit.png';

Redseb
  • 199
  • 10