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
/
means the root of the current drive;
./
means the current directory;
../
means the parent of the current directory.
In reference to the quick reference list, specifically you can use the following :
\.\ Root Directory + Current directory (Drive Letter)
Yes, ./
means the current working directory. You can just reference the file directly by name, without it.
You are correct that you can omit it. It's useful only for clarity. There is no functional difference between it being there and not being there.
./
is the the folder that the working file is in:
So in /index.htm
./
is the root directory
but in /css/style.css
./
is the css folder.
This is important to remember because if you move CSS from /index.htm
to /css/style.css
the path will change.
A fast and small recap about paths
http://website.com/assets/image.jpg
IF the image is not on your domain - go look there for image
//website.com/assets/image.jpg
image loaded using http or https protocols
(For internal use if the image is on the same server)
image.jpg
image in the same place as the document calling the image!
./image.jpg
Same as above, image in the same place as the document calling the image!
/assets/image.jpg
Similar to Absolute Paths, just omitting the protocol and domain name
Go search my image starting from my root folder /
, than into assets/
assets/image.jpg
this time assets is in the same place as the document, so go into assets for the image
../assets/image.jpg
From where the document is, go one folder back ../
and go into assets
../../image.jpg
go two folders back, there's my image!
../../assets/image.jpg
go two folders back ../../
and than go into assets