How to go up a level in the src path of a URL in HTML?

后端 未结 6 1274
北荒
北荒 2020-11-28 02:06

I am storing style sheets in {root}/styles while images in {root}/images for a website. How do I give the path in the style sheets to go look in the images directory for th

6条回答
  •  暖寄归人
    2020-11-28 02:57

    In Chrome when you load a website from some HTTP server both absolute paths (e.g. /images/sth.png) and relative paths to some upper level directory (e.g. ../images/sth.png) work.

    But!

    When you load (in Chrome!) a HTML document from local filesystem you cannot access directories above current directory. I.e. you cannot access ../something/something.sth and changing relative path to absolute or anything else won't help.

提交回复
热议问题