Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to introduce absolute path, relative path and root directory of files by HTML

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is a detailed introduction to "how HTML introduces the absolute path, relative path and root directory of files". The content is detailed, the steps are clear and the details are properly handled. I hope this article "how HTML introduces the absolute path, relative path and root directory of files" can help you solve your doubts. Let's go deeper and learn new knowledge together with the ideas of Xiaobian.

What is an absolute path?

Absolute path refers to the real path of the file, using absolute path to link external resources, such as: images, hyperlinks, flash, audio, video, etc. The code is as follows:

1. Introducing resources on the network:

2. Introduce the absolute path of the local computer, such as the image named "a.jpg" in the images folder under D disk:

Absolute path must enter a complete description of the path, this method points to the link destination address is clear, but there is a disadvantage is that once the file is moved or deleted for a long time will cause the file can not be displayed, you need to reset the relevant links.

What is a relative path?

Relative path refers to the relationship between the path of the file and the path of other files (or folders).

"../" is often used in relative paths "to indicate a superior directory, if there are multiple superior directories, you can use multiple"../ "means superior;

If you link to the current directory, just enter the name of the linked object, such as: a.jpg;

If you link to the next directory, simply enter the directory name, or./ File name, and then enter the object name, such as: images/aaa.jpg or./ images/aaa.jpg;

To sum up, if you quote the style.css file in the css folder under the parent directory, the code is: ../../ css/style.css 。

Relative path is suitable for internal reference of website, as long as it is in the same site, you can freely construct links between files, independent of the server where the site is located, this writing form omits the same part of the absolute path, and can change the server address of the site file.

What is root directory?

The root directory refers to the topmost directory of the logical drive, and the local root directory such as C disk, D disk, etc.;

Web site root refers to the use of multiple sites on a server at the same time, or a large-scale site needs to be placed on several servers.

The root directory is represented by "/". For example, the file named "a.jpg" in the images folder under D disk is coded as: /images/a. jpg.

Read here, this article "how to introduce HTML file absolute path, relative path, root directory" article has been introduced, want to master the knowledge points of this article also need to practice to understand, if you want to know more related content of the article, welcome to pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report