To reference files relative to the current page, you can either write the path plainly without a prefix, or you can be explicit about it by prefixing with ./
. To reach files with paths relative to the root of your site, you prefix the path with /
.
Summary
/
absolute path (full path to resource from root directory)
./
relative path from current directory (equal to not specifying any folder prefix)
../
relative path from parent directory
../../
relative path from parent of parent
Examples
Current URL Resource path Resolves to
/pages/home.html ./picture.jpg /pages/picture.jpg
/pages/home.html ../img/picture.jpg /img/picture.jpg
/pages/about/home.html /img/picture.jpg /img/picture.jpg
/pages/about/home.html img/picture.jpg /pages/about/img/picture.jpg
/home.html img/picture.jpg /img/picture.jpg