Absolute and Relative path for beginners

Save 15% On Pluralsight - Annual Subscription Only $299

Pluralsight courses
LinkedIn Premium uses PayScale to estimate job salaries

Save 15% On Pluralsight - Annual Subscription Only $299


Premium (Not Free) Video Tutorials

Free Video Tutorials & Free Tools

When you're creating links to documents and images on the Web, you need to think about how you're going to link to them. There are two standard ways to create links: •absolute paths •relative paths Absolute Path URLs Absolute paths are called that because they refer to the very specific location, including the domain name. The absolute path to a Web element is also often referred to as the URL. For example, the absolute path to this Web page is: http://webdesign.about.com/library/weekly/aa040502a.htm You typically use the absolute path with the domain to point to Web elements that are on another domain than your own. For example, if I want to link to the Graphic Design Guide's site – I need to include the domain in the URL: http://graphicdesign.about.com/. So a link to her glossary entry would look like this: If you're referring to a Web element that is on the same domain that you're on, you don't need to use the domain name in the path of your link. Simply leave off the domain, but be sure to include the first slash (/) after the domain name. For example, the Beginner's Resource Center has the URL: http://webdesign.about.com/library/beginning/bl_begin.htm If I were to link to this URL from another page on my site, I could link to it in this way: It is a good idea to use absolute paths, without the domain name, on most Web sites. This format insures that the link or image will be usable no matter where you place the page. This may seem like a silly reason to use longer links, but if you share code across multiple pages and directories on your site, using absolute paths will speed up your maintenance. Relative Path URLs Relative paths change depending upon what page the links are located on. There are several rules to creating a link using the relative path: •links in the same directory as the page have no path information listed filename •sub-directories are listed without any preceding slashes weekly/filename •links up one directory are listed as ../filename How to determine the relative path: 1.Determine the location of the page you are editing. This article is located in the/library/weekly folder on my site. 2.Determine the location of the page or image you want to link to. The Beginner's Resource Center is located here: /library/beginning/ 3.Compare the locations and to decide how to point to it From this article, I would need to step up one directory (to/library) and then go back down to the beginning directory 4.Write the link using the rules listed above: Thanks to jennifer of about.com Original article – http://webdesign.about.com/od/beginningtutorials/a/aa040502a.htm

Related posts:

  1. Web Promotion by: admin123 Web promotion can be considered as a continuing...

Related posts brought to you by Yet Another Related Posts Plugin.

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

Powered by WP Hashcash

This blog uses the cross-linker plugin developed by Web-Developers.Net