Chaitanya Jain
Chaitanya Jain

Reputation: 9

Root directory when linking css file to html file

While learning about paths I found out that "/" takes you to the root directory. I made .html and .css files in the same directory to test how it behaves for different paths. When linking the css file, href = "app.css" and href = "./app.css" both work fine but when I try href = "/app.css" it doesn't link. I know "/" is suposed to take you to the root directory and from what I understand the directory of the html file is the root directory. So why isn't the css file linking properly?

Upvotes: 0

Views: 1245

Answers (2)

Harman
Harman

Reputation: 158

/ means the root of the current drive

./ means the current directory

../ means the parent of the current directory

Upvotes: 1

sonicspark
sonicspark

Reputation: 25

No need to add the "/" or "./" because your app.css file is in your current directory.

Upvotes: 0

Related Questions