Review the differences between relative paths and absolute paths in html.
In HTML, As long as files are involved (such as hyperlinks and images), the concept of absolute paths and relative paths is involved. 1. absolute path refers to the path in which the file actually exists on the hard disk. For example, if the image "Export bg.jpg" is stored in the "E: \ book \ webpage layout Code \ chapter 2nd" directory on the hard disk, then the absolute path of the image "Export bg.jpg" is "E: \ book \ Web page layout \ code \ chapter 2nd \ bg.jpg ". If you want to use an absolute path to specify the background image of a webpage, use the following statement: <body backround = "E: \ book \ webpage layout \ code \ chapter 2nd \ bg.jpg"> 2. disadvantages of using absolute paths in fact, absolute paths are rarely used in Web programming. If "E: \ book \ Web page layout \ code \ chapter 2nd \ bg.jpg "to specify the location of the background image. browsing on your computer may be normal, however, if you upload the image to the Web server, it is likely that the image will not be displayed. When uploading data to a Web server, the entire website may not be stored on the Elastic Block Storage (edisk) of the Web server. It may be a drive D or drive H. Even if it is stored in the E disk of the Web server, the E disk of the Web server may not contain the directory "E: \ book \ webpage layout \ code \ chapter 2nd, therefore, images are not displayed when you browse a webpage. 3. The relative path is usually used when a file is specified on the webpage to avoid this situation. The relative path is relative to the location of the target file. For example, when the following code is used in the "“s1.htm" folder "file, as long as the relative positions of the two files are not changed (that is, they are still in the same directory ), therefore, no matter where the image is uploaded to the Web server, the image can be correctly displayed in the browser. <Body background = "bg.jpg"> assume that the directory of the s1.htm file is "E: \ book \ webpage layout \ code \ Chapter 2", and that of the image "“bg.jpg" is "E: \ book \ webpage layout \ code \ chapter 2nd \ img.pdf, so the bg.jpg?image is in the "img" subdirectory of its directory relative to the s1.htm file, the statement for referencing the image should be: <body background = "img/bg.jpg"> Note: The relative path uses the "/" character as the delimiter for the directory, the absolute path can use the "\" or "/" character as the delimiter of the directory. Because the "img" directory is a subdirectory under the "Chapter 2nd" directory, you do not need to add the "/" character before "img. In the relative path, "../" is often used to represent the upper-level directory. If there are multiple upper-level directories, you can use multiple "../", such as "http://www.cnblogs.com/#. Assume that the directory where the “s1.htm file is located is "E: \ book \ webpage layout \ code \ chapter 2, and the directory where the picture" “bg.jpg "is located is" E: \ book \ webpage layout \ code ", for example, if the upload bg.jpg1_image is in the parent directory of the “s1.htm file, the statement for referencing the image should be: <body background = ".. /bg.jpg "> For another example, the directory where the s1.htm file is located is" E: \ book \ webpage layout \ code \ chapter 2, and the image "" E: \ book \ Web page layout \ code \ imgloud. For example, when bg.jpg?image is in the "img" subdirectory of the parent directory of its directory, the statement for referencing the image should be: <body background = ".. /img/bg.jpg "> 4. relative paths related to virtual directories have a special representation: "relative virtual directories ". See the following example: <body background = "/img/bg.jpg"> in this example, the value of the background attribute is "/img/bg.jpg ", note that there is a "/" character before "img. This "/" indicates the root directory of the virtual directory. assume that "E: \ book \ webpage layout \ code" is set as a virtual directory, then the actual path of "/img/bg.jpg" is "E: \ book \ webpage layout \ code \ img \ bg.jpg "; if" E: \ book \ webpage layout \ code \ chapter 2nd "is set as a virtual directory, the actual path of "/img/bg.jpg" is "E: \ book \ webpage layout \ code \ chapter 2nd \ img \ bg.jpg"