What is a URL?
Application Example: Can be a picture, such as resource address, browser address bar URL, etc.
Uniform Resource Locator Uniform Resource Locator
Http://www.123.com/infor/index.html
A URL consists of four parts:
The first part: protocol, e.g. http://
The second part: domain name (or hostname, server name), such as: www.123.com
Third section: folders, such as: infor
Fourth part: File name, such as: index.html
?
In HTML, the concept of absolute and relative paths is involved whenever a file is involved (such as hyperlinks, images, etc.):
- Absolute URL
Absolute URL is the real path on the hard drive of the file or directory on the home page of your site
?
An absolute URL is a URL that always begins with a domain name (or/), which is the absolute URL.
Note: "/" represents the site root of the domain name.
Example: Http://www.baidu.com/image/baobao.gif
???? Tip: When using the absolute URL, only need to filter the target file is who, do not need to filter the current file is who.????
To reference a picture resource:
(2) Relative URL: Do the site with the most is the relative path
- Implementation criteria for relative URLs:
A) who is the current file?
b) who is the target file? (Resource files that need to be introduced)
c) What is the relationship between the current file and the target file?
Peer Relationship : write the target file name directly????????????
Subordinate relationship : The target file under a folder, write the directory name of the sibling, and then write the file name under the directory. Images/baobao.gif
Parent Relationship : directory files in the previous level of the directory, first go up a level, then find the appropriate folder, and then find the file.
./Current File
????.. /go up one level
????.. /.. /go up two levels
????.. /day1/images/01.gif
Absolute and relative URLs