Posted By

thesmu on 02/04/13


Tagged

css html


Versions (?)

Absolute and Relative Paths


 / Published in: CSS
 

URL: http://webdesign.about.com/od/beginningtutorials/a/aa040502a.htm

relative path cheat sheet

  1. Relative Path URLs
  2.  
  3. Relative paths change depending upon the page the links are on. There are several rules to creating a link using the relative path:
  4.  
  5. links in the same directory as the current page have no path information listed
  6. filename
  7. sub-directories are listed without any preceding slashes
  8. weekly/filename
  9. links up one directory are listed as
  10. ../filename
  11. How to determine the relative path:
  12.  
  13. 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
  14. Then look at the directory path for the page. For this article, that is /od/beginningtutorials/a/
  15. 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
  16. And look at the directory path for that page: /od/beginningtutorials/ss/
  17. 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.
  18. Write the link: <a href="../ss/aasspagehtml1.htm">How to Create a Web Page with HTML</a>

Report this snippet  

You need to login to post a comment.