In the HTML Introduction, we learned how to create a link with the anchor tag
<a>. You already know you need a web address in the HREF section of an anchor tag to make it actually link to some other page. What you may not know is that you don’t always have to use the whole http://www.etc.com address when you create a link.
Before we tackle these explanations, however, let’s take a look at the components of a URL:
- The first part is the transfer protocol — in this case, HyperText Transfer Protocol.
- The second part is the address of your server — in this case, the World Wide Web server at BU.
- The third part is the directory/folder of your web space area.
- The last part is an internal folder inside the parent directory.
Sometimes you can use just a filename. Sometimes you can use just a slash ( / ) followed by the directory name. And sometimes you do have to use the whole address. Let’s review the differences.