Problem: image not adding to html

This task seemed easy, but all of my attempts were unsuccessful. I searched other sources, including Google AI. Just wanted to give a quick thanks for helping out a newbie.

Question: What is the html syntax to add an image from a source with the local PC environment?

The relative path to your images is,

src="images/%image.png%"

Not sure why you would need a ‘root’ folder in the images folder; nor, why you would have an ‘index.html’ page buried in that folder. On a web server the home page is located in what is referred to as the ROOT DIRECTORY. The absolute path to the home page is,

https://www.example.com/
                       ^
                   site root

Depending how the site is developed the site root could have any of the following file names:

  • index.html
  • index.htm
  • index.php
  • index.asp

Some servers also recognize the name, home, or, ‘default’, as in home.html or ‘default.html’ which would be located in the absence of an index.___ file in the root directory. This is not important to know, just now.

Bottom line, use the simplest possible folder structure to make your job of building and maintaining a lot easier.

3 Likes

I’m sticking my neck out here because I am re-entering coding after a long break, but if your files are in the same directory couldn’t you use relative paths to go up or down directories to your content? That way if you move your directory to another location, your links would still work (Quick Reminder About File Paths | CSS-Tricks)

2 Likes

I went ahead simplified my folder structure, and it did make it a lot easier! I appreciate the critique.

3 Likes