What's an Absolute Path?
There are two ways to put links to Internet addresses on your webpages. One way is to use absolute URLs in the HREF="..." attribute (i.e., a site's entire Internet address, all the way from the http:// on down to the pagename.html). These URLs show an "absolute" path through a folder structure to a Web page, from the server down to the specific file. For example, the absolute path for this web page is:
Absolute paths are essential when linking outside of your site because your browser can't locate a file on the Web unless it knows the site's exact location. When you click on an absolute path to a web page on the Internet, you have to have a live Internet connection to reach that site. This can be a problem if you want to test your own pages on your computer before making them live. For this reason, when you're linking to another page within your own site, it can be helpful to set up your links using relative paths instead of absolute paths.
What's a Relative Path?
Relative paths tell your browser the location of other Web pages within your site's folder structure "relative" to the page you happen to be viewing, using a shorthand of "../" to indicate movement one level up in the folder hierarchy. To move two levels up, just double the shorthand by using "../../" (Old-school DOS and UNIX users will recognize this shorthand immediately.) The page you're reading right now is in a folder called "basics". One of the images we used at the top of our main Index page (the right part of the TeacherTECH logo) is located in the images folder (which is in the TeacherTECH folder, just like the basics folder is). If we wanted to link to that image from this page, we could either write out the absolute path, like this:
Or we could write a link indicating the picture's location relative to this page's location, i.e., the "banner.gif" image in the banner folder, which is the same level as the "basics" folder, like this:
Try both of the links out and see if they display the same picture.
Here are some more examples:
This link would take you to the index page one folder level above the page where the link appears.
This link would take you to the index page two levels above the page where the link appears. Note, when you end your URL in a "/" the browser will look for and load the index.html file in that folder, meaning that you could leave it out of either of the two preceding examples, and write them like this:
If you want to climb up three directory levels and then down into another branch of the filesystem tree, just append the new path like this:
would take you to a folder two levels up and then down into a folder named "content", into a folder named "squirrels", to the index page there.
By now you know enough to write a very nice, text-based home page, but it is the ability of the World Wide Web to provide pictures, technically called images, graphics, or sometimes icons, that has made it so popular. In this Primer, you'll learn how place an image on your page and also how to turn an image into a link to another page. An excellent tutorial for linking images can be found at HTML Goodies. This link will take you out of the TeacherTECH site, so you will need to choose the back button to return.
Basic HTML: Images
Linking Word (or other file type) documents
You can link a word (or other file type document) the same way as an html file. You must take into consideration that the machine that is downloading the file must have the appropriate software. The relative/absolute links are done in the same manner.
Creating a mailto:
If you are going to create an e-mail link, there are several considerations. The text that is seen needs to be written, and a mailto link must be created. You should be aware that certain software will search for e-mails listed on web site and spam is generated in this manner. I would suggest that you either write your e-mail in a 'criptic' fashion, ie. sboone at houstonisd(dot) org (this doesn't look very nice though...) - or- just state your name: E-mail the webmaster, or e-mail me. Once you have decided on the text, then you can create a hyper link: <a href= "mailto:firstname.lastname@example.org">
Example: E-mail me with comments
The code for this link is:
<a href="mailto:email@example.com">E-mail me with comments</a>