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

前端 未结 10 1243
北海茫月
北海茫月 2020-11-22 07:17

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

相关标签:
10条回答
  • 2020-11-22 07:47

    / means the root of the current drive;

    ./ means the current directory;

    ../ means the parent of the current directory.

    0 讨论(0)
  • 2020-11-22 07:51

    In reference to the quick reference list, specifically you can use the following :

    \.\ Root Directory + Current directory (Drive Letter)

    0 讨论(0)
  • 2020-11-22 07:53

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

    0 讨论(0)
  • 2020-11-22 07:54

    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.

    0 讨论(0)
  • 2020-11-22 07:58

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

    0 讨论(0)
  • 2020-11-22 07:59

    A fast and small recap about paths

    Absolute paths

    http://website.com/assets/image.jpg
    IF the image is not on your domain - go look there for image


    //website.com/assets/image.jpg
    image loaded using http or https protocols


    Relative paths

    (For internal use if the image is on the same server)


    image.jpg
    image in the same place as the document calling the image!


    ./image.jpg
    Same as above, image in the same place as the document calling the image!


    /assets/image.jpg
    Similar to Absolute Paths, just omitting the protocol and domain name
    Go search my image starting from my root folder /, than into assets/


    assets/image.jpg
    this time assets is in the same place as the document, so go into assets for the image


    ../assets/image.jpg
    From where the document is, go one folder back ../ and go into assets


    ../../image.jpg
    go two folders back, there's my image!


    ../../assets/image.jpg
    go two folders back ../../ and than go into assets

    0 讨论(0)
提交回复
热议问题