/ Published in: CSS
relative path cheat sheet
- Relative Path URLs
- Relative paths change depending upon the page the links are on. There are several rules to creating a link using the relative path:
- links in the same directory as the current page have no path information listed
- sub-directories are listed without any preceding slashes
- links up one directory are listed as
- How to determine the relative path:
- First define the URL of the page you are editing. In the case of this article, that would be http://webdesign.about.com/od/beginningtutorials/a/aa040502a.htm
- Then look at the directory path for the page. For this article, that is /od/beginningtutorials/a/
- Get the URL of the page you want to link to. For this example that would be the “How to Create a Web Page with HTML” article: http://webdesign.about.com/od/beginningtutorials/ss/aasspagehtml1.htm
- And look at the directory path for that page: /od/beginningtutorials/ss/
- Compare the two paths, to determine how to link to it. From this article I would need to step up one directory from the /a/ directory and then go back down to the /ss/ directory using the code ../ss/aasspagehtml1.htm.
- Write the link: <a href="../ss/aasspagehtml1.htm">How to Create a Web Page with HTML</a>
You need to login to post a comment.