I always manage to forget the syntax for traversing folders. So for the recorded, this is how it’s done:

  • / means drop back to the root folder then traverse from there. For example <img src="/assets/images/banana.jpg" alt="banana"> the images folder is at the root level
  • ./ means start at the current working directory. In this example, <img src="./images/banana.jpg" alt="banana"> the images folder is a current working directory which could be something like /assets
  • ../ means go up one directory from the current working folder. So looking at this example, <img src="../banana.jpg" alt="banana"> the current working directory might be /assets the next level up would be /assets/images where the banana.jpg file is.

It’s not especially complicated but not getting this right can really mess with your mind when things aren’t working.


Posted

in

by