htmlcsshtml-head

Purpose of ./ before call to a stylesheet?


I saw the below head section in a page and I don't understand the purpose of the ./ before the stylesheet call. I checked the directory for the site and the stylesheet is in the same directory as the index page.

<head>
    <meta charset="utf-8">
    <title>Site Title</title>
    <link rel="stylesheet" type="text/css" href="./styles.css">
</head>

Solution

  • . refers to the current directory (that the HTML page is in) and ./styles.css refers to a file called styles.css in the current directory. See here for more info https://stackoverflow.com/a/24340516/8595398