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

前端 未结 10 1434
北海茫月
北海茫月 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: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

提交回复
热议问题