I know ../
means go up a path, but what does ./
mean exactly?
I was recently going through a tutorial and it seems to be referring to just
. = This location
.. = Up a directory
So, ./foo.html
is just foo.html
. And it is optional, but may have relevance if a script generated the path (relevance to the script that is, not how the reference works).
For example css files are in folder named CSS
and html files are in folder HTML
, and both these are in folder named XYZ
means we refer css files in html as
<link rel="stylesheet" type="text/css" href="./../CSS/style.css" />
Here ..
moves up to HTML
and .
refers to the current directory XYZ
---by this logic you would just reference as:
<link rel="stylesheet" type="text/css" href="CSS/style.css" />
Yeah ./
means the directory you're currently in.
You can use the following list as quick reference:
/ = Root directory
. = This location
.. = Up a directory
./ = Current directory
../ = Parent of current directory
../../ = Two directories backwards
Useful article: https://css-tricks.com/quick-reminder-about-file-paths/