Can I link to images that are stored locally on my own computer?


#1

Question

Rather than using a url to link to images that exist on the web, can I link to images that are stored locally on my own computer?

Answer

Yes you can! In fact, developers often work locally before pushing their code to production. When dealing with assets like images, we will often want to include them in a folder which will also contain our HTML document. With a properly arranged directory or folder structure, we can create a path which points to our image and is relative to our HTML document. In this scenario, this relative path will be the value of the <img> src attribute.

For more information about relative and absolute paths, take a look at this chapter.


FAQ: Learn HTML Elements - Intro to HTML - Images