web front commonly used file .html .css .js. But when introduced resources (such as images) using css files and html, the path may not be the same. The following summarizes a few.
Using a relative path introduced rules:
- html or js introduced pictures, html to count by category
- css introduction of picture, calculated according to the css directory.
What is html directory:
For example: HTTP: // ip / a / b request to come back are html files, html files directory is / a / folder, if this piece of code html:
<link rel="stylesheet" href="css/aa.css">
Well, actually referenced css file path is /a/css/aa.css
What is the css directory
It simply is css file to store addresses. Here is /a/css
connected to the above address, css file ( /a/css/aa.css
) after being referenced, it has a code background:url('img/cc.png')
.
Then cc.png
the address is actually referenced /a/css/img/cc.png
.
Problems:
If the front end of the route and the use history
mode is introduced using relative path, the problem may be. When the route reaches the level 2 address directory for example: http://ip/1/2
this page if there is a reference to a relative path, it will fail. All relative references will be address before adding /1/
the directory address. When you refresh this page, bug came out.
ps: here mentioned address before the address is not packed, it is real after packed address. The next one will note this point, using a nginx + port, a plurality of single-page application deployment using distal route (History Mode).