Mary624
Mary624

Reputation: 75

Relative path using "./"

Im working with some code that uses "./" to describe a path to the stylesheet in the header.

<link rel="stylesheet" href="./public/css/style.css">

I am familiar with "../" - go up one level and follow path from there

and "/" - follow path from root directory

It seems "./" is a relative path but why use it at all? Why not just write the path as public/css/style.css

Upvotes: 3

Views: 59

Answers (1)

phpchap
phpchap

Reputation: 382

./ means relative to the current directory.

You are correct, the two ways of writing the path are exactly the same and both will work fine.

Using ./ may help in the case that a script generates the path.

Upvotes: 1

Related Questions