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
Install lua wget http://luajit.org/download/LuaJI...
As a required course for front-end developers, CS...
1. Get the image #Specify the version that includ...
Version Chain In InnoDB engine tables, there are ...
Table of contents Introduction to NIS Network env...
Standalone hbase, let’s talk about it first. Inst...
First of all, you can understand the difference b...
Table of contents Installing the SDK Managing loc...
Table of contents Preface 1. Prepare new partitio...
Preface These principles are summarized from actu...
This article shares the detailed steps of install...
Disable swap If the server is running a database ...
Recently, several data anomalies have occurred in...
1. Cause: I need to import a sql file, but I can&...
Preface ActiveMQ is the most popular and powerful...