5.html 5 path Representation

Source: Internet
Author: User

5.html 5 path Representation

The role of paths in html is to introduce external resources, such as css files, js files, and media files.

The paths are divided into relative paths and absolute paths. The relative path is another page path relative to the link page. The absolute path is the complete Path Directly starting from file: // disk operator. (Note: The drive letter is mainly for windows ).

1. absolute path

<A href = "file: // D:/HTML5/code/index2.html"> index2 </a>

Explanation: First, it starts with file: //, then a disk character, and then a directory hierarchy to find the corresponding file. The most critical problem with this method is that when the entire directory is transferred to another drive letter or another computer, once the directory structure changes, the link immediately becomes invalid.

2. Relative Path

<A href = "index2.html"> index2 </a>

Explanation: The relative path must be in one disk or directory. If the file is in the same directory, the directly connected property value is the linked file name. suffix. If there are multiple sub-directory layers under the same main directory, you need to use the directory structure syntax.

3. Directory syntax

The same Directory: index2.html or./index2.html;

In the subdirectory: xxx/index2.html;

In the sun tzu Directory: xxx/index2.html;

In the parent directory: ../index2.html;

In the grandpa's directory: ../index2.html;

Finally, it should be noted that, no matter whether you find it or not, the path separators in windows and linux systems are different. windows is \, while linux is /. However, no matter what platform is finally running, the path representation must use the linux habit, that is /.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.