What does “./” (dot slash) refer to in terms of an HTML file path location?

What does “./” (dot slash) refer to in terms of an HTML file path location?

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 a file in the same location, so is it necessary at all? Can I just not use it if that’s all it’s doing?


Solution 1:

./ 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.

Solution 2:

/ means the root of the current drive;

./ means the current directory;

../ means the parent of the current directory.

Solution 3:

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:

Related:  Opposite of ng-cloak for loading message

Solution 4:

.  = 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).

Solution 5:

Yes, ./ means the current working directory. You can just reference the file directly by name, without it.

Solution 6:

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.