Relative path - a directory path established based on the location of the web page that references the file. Therefore, when web pages saved in different directories reference the same file, the paths used will be different, so it is called relative. Absolute path - a directory path based on the root directory of the Web site. It is called absolute because when all web pages reference the same file, the path used is the same. In fact, the difference between an absolute path and a relative path is only that different reference points are used when describing the directory path. Since the root directory is the same reference point for all files on the website, the path description method using the root directory as a reference point is called an absolute path. The following are several special symbols used to establish paths and their meanings. "."--represents the current directory. ".."--represents the upper directory. "/"--represents the root directory. Next, we assume that the website created by the reader has the directory path shown in the following figure. ![]() If you want to reference the BeRef.gif file in the Ref.htm file, the relative path is as follows: ./SubDir2/BeRef.gif In the reference path above, "." represents the current directory (Dir1), so "./SubDir2" represents SubDir2 in the current directory. In fact, you can also omit "./" and directly use this method to quote. SubDir2/BeRef.gif If you use an absolute path to reference the file with the root directory as the reference point, the reference path is as follows: /Dir1/SubDir2/BeRef.gif If the directory structure of the Web site is as shown below ![]() What about the relative path of the BeRef.gif file? In the reference path above, ".." represents the parent directory, so "/Dir2" represents the Dir2 subdirectory under the parent directory. If an absolute path is used for reference, the reference path is as follows: Let's take a more complicated example to compare the use of relative paths and absolute paths. Assume that the website you created has the directory path as shown in the figure below. ![]()
What needs to be explained in the above table is the meaning of "../../". |
<<: Detailed use cases of vue3 teleport
>>: How to connect Navicat to the docker database on the server
Since the default Linux kernel parameters are bas...
Recently, many students have asked me about web p...
Table of contents Preface Virtual DOM What is Vir...
CSS media query has a very convenient aspect rati...
To put it simply, website construction is about &q...
Overview In actual business scenario applications...
MySQL installation is divided into installation v...
Table of contents 1. Constructors and instances 2...
The Docker container provides services and listen...
Table of contents Code cleaning "Frames"...
Table of contents 1. Introduction to FastDFS 1. I...
<br />With the increase of bandwidth, there ...
Table of contents 1. v-if 2. Use v-if on <temp...
I don’t know if you have ever encountered such a ...
Table of contents 1. Problem Description 2. Probl...