Absolute path / relative path / root path

1. absolute path

Generally it refers to the full path. Path up to the current file from the top level folder.

// local file 
File: // /Users/lyralee/Desktop/MyStudy/React/webpackdemo/dist/main.js 
// server file 
HTTP: // test.com/file/index.js

2. Relative path

Relative to the current file. There are several representation.

1. The current file and directory at the same level

<Script src = "main.js"> </ Script>
 // represents main.js files and html files in the same directory

2. Relative symbol ./ or ../

// ./ represent html files and directories at the same level
<script src="./main.js"></script>
// ../ represents the parent directory where the html file folder 
<script src = .. / main.js " > </ script>

3. root / XXX

Indicates that a file in the root direct access path.

// represents main.js access file in the root directory 
<script src = / main.js "> </ script>

 

Guess you like

Origin www.cnblogs.com/lyraLee/p/11901739.html