curriculum/challenges/english/blocks/lecture-working-with-links/6716830dbaf95da9564f2e3b.md
You may have seen links like /public/logo.png, ./script.js, or ../styles.css before. But what do these special types of links mean? These are called file paths. There are three key syntaxes to know. First is the slash, which can be a backslash (\) or forward slash (/) depending on your operating system. The second is the single dot (.). And finally, we have the double dot (..).
The slash is known as the "path separator". It is used to indicate a break in the text between folder or file names. This is how your computer knows that naomis-files/ points to a directory of that same name, while naomis/files/ points to a files directory in the naomis directory.
A single dot points to the current directory, and two dots point to the parent directory. You will typically see a single dot used to ensure that the path is recognized as a relative path. Remember that you learned in a previous lesson about relative versus absolute paths before.
Double dots, however, are much more common to access files outside of the current working directory.
For example, given this file tree:
my-app/
├─ public/
│ ├─ favicon.ico
│ ├─ index.html
├─ src/
│ ├─ index.css
│ ├─ index.js
If your public/index.html file needed to load the favicon.ico file, you would use a relative path with a single dot to access the current directory: ./favicon.ico. If your public/index.html file needed to load the index.css file, you would use a relative path with double dots to navigate to the parent my-app directory first, then to the src directory, and finally to your file: ../src/index.css.
Which option is an absolute path?
/public/styles.css
./script.js
An absolute path starts with a slash.
../src/nav.html
An absolute path starts with a slash.
https://freecodecamp.org
An absolute path starts with a slash.
1
Which option is a relative path to the current directory?
/public/styles.css
A single dot points to the current directory.
./script.js
../src/nav.html
A single dot points to the current directory.
https://freecodecamp.org
A single dot points to the current directory.
2
Which option is a relative path to the parent directory?
/public/styles.css
A double dot points to the parent directory.
./script.js
A double dot points to the parent directory.
../src/nav.html
https://freecodecamp.org
A double dot points to the parent directory.
3