In most of the examples we’ve used thus far, the value of the href attribute has been a complete URL – also called an absolute link – as in ‘http://www.w3c.org’. This is the best choice if you’re linking to a site separate from your own.
But what if you’re simply linking to another page on the same web site? In this case, you could use a relative link, which is one that is relative to the current page. An example might be ‘../aboutus/location.html’. In this case, the browser understands that a dot-dot-slash (../) indicates to go back, or up, a level in the directory structure. From there, it will look for the ‘aboutus’ folder, inside of which will be a file named ‘location.html.’
Post a Comment