skip to Main Content

I want to know how img in html accesses images stored locally. I’m trying to add an image saved in pictures folder but the browser is displaying images that are saved on my desktop only. How can I display images stored in other folders?

<img src="pictures/erd.jpg" alt="ERD"/>

Here, the image I want to display is stored in pictures folder but the browser only displays alt text .

2

Answers


  1. What editor are you using …it depends on your editor ..different editor have different ways of adding images in your code some you have to drag and drop the image to the root of the folder you are coding in ..others you just write the path of the image the same it is in your desktop

    Login or Signup to reply.
  2. The src property accepts a path which is related to the location of the HTML page. The path should be a relative path from the location of the HTML page to the location of the image. So if the page is in the Documents folder and the image is in the Pictures folder, the path might by something like "../Pictures/erd.jpg".

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search