Home > Back-end >  html image will work on one page but not another
html image will work on one page but not another

Time:02-19

Im using Atom to do some homework, I am a beginner at html this is my first assignment and I am trying to make my first page, however I am having problems getting my images to show up. I got them to show up on a previous page and now I have moved on to a different page and tried to use the same and it won't show up, I even tested it on another page and it works on there, I don't understand what im missing can someone please steer me in the right direction.

CodePudding user response:

May be you are using wrong path. Can you please share your code ?

CodePudding user response:

img tags have a property named src. this prop should fill with path of your image. if you use absolute path, it should started with '/'. imagine that you have a directory named 'public' and a file named 'image.png' in that directory. you can use img tag like this:

<img src="/public/image.png"/>

keep in mind that start slash is referred to the base directory of your project. to check the path, you can inspect in your html file. open your html file in your browser. right click and select inspect (or you can press F12 and go to inspector tab if you are using firefox or chrome). find the <img {...}/> element and check it's src prop and path url. keep in mind that the path should open the image. if that's not happening, there is a problem with your path.

  • Related