Absolute and Relative Links

Table of Content

Absolute and Relative Links When designing a website there are two ways for an image or file to be linked to the page. This is done be using an absolute link or a relative link. Both kinds of links must be contained within an a href attribute; however, there are some differences between two that must be considered prior to deciding which to use. Absolute Links As the name suggests, an absolute link defines the location of an image or file absolutely. All of the information is included in this link: the protocol, domain name, directory, and the name of the document in question.

The anchor would therefore look similar to this: Homepage Relative Links A relative link by contrast uses a shortened version of the above anchor to get the user from one page to another. This can be accomplished because once the server knows the location of the current document it can then link to any other document in the same directory without the need of the full URL. Therefore a relative tag may look similar to this: Because the Lake. jpg is also contained in the “site” directory there is no need to explain further.

This essay could be plagiarized. Get your custom essay
“Dirty Pretty Things” Acts of Desperation: The State of Being Desperate
128 writers

ready to help you now

Get original paper

Without paying upfront

If, for example, the Lake. jpg was located in an “images” directory within the “site” directory the tag would look like this: Likewise to link from the homepage to another page on the site the tag would look like so: Rivers Both absolute and relative links have there place in web design. However, when designing larger web sites it will save much time and space to use relative links where ever possible to link the pages and images on the site. Absolute links should still be used when sending a user to another site.

You can see how using relative links can save you a lot of typing, especially if the source page and destination page are in the same folder on your web server. On the other hand, relative links will work even if you later move the source page to a different part of the site (although that won’t help you if the destination page moves). Another advantage of using relative links is that many HTML editing programs will check for broken links any time you move a file. These programs will detect and fix relative links but may or may not fix absolute links. Check with your HTML editor’s Help files if you’re not sure.

Cite this page

Absolute and Relative Links. (2018, Mar 24). Retrieved from

https://graduateway.com/absolute-and-relative-links-essay/

Remember! This essay was written by a student

You can get a custom paper by one of our expert writers

Order custom paper Without paying upfront