HTML and CSS Reference
In-Depth Information
Absolute and Relative Links
The link to Yahoo! you just created is an absolute link. Notice that the XHTML code
for the link indicates the protocol being used, http://, and continues with the domain
name, This indicates the absolute location of the Web resource. Use
absolute links when you are creating links to other Web sites.
When you need to link to Web pages within your site, use a relative link . This link does
not begin with http://. It only contains the file name or file name and folder of the Web
page you want to display. The link location is relative to the page currently being dis-
played. For example, if you had a home page called index.html and wanted to link to a
page with your resumé (called resume.html) located in the same folder as index.html,
the XHTML for the relative link would be as follows:
<a href="resume.html">My Resume</a>
The best way to learn XHTML is by writing it. Let's experiment with the anchor tag
and create a sample Web site to use to practice creating hyperlinks.
First, create a new folder called mywebsite.
Windows XP Users. Launch Windows Explorer by selecting Start, Programs,
Windows Explorer with your pointing (mouse) cursor. Click your drive to select
it. Select File, New, Folder.
Windows Vista Users. Launch the Computer folder by selecting Start, Computer
with your pointing (mouse) cursor. Click your drive to select it. Select Organize,
New Folder.
Mac Users. Look in the Dashboard for the Finder icon and click on it with your
pointing (mouse) cursor. Select the Documents folder. Select File, New Folder.
Name your folder mywebsite. This site is an example of a personal Web site. It will
contain a home page called index.html and two content pages called resume.html and
favorites.html. A sample site map that was created using Adobe Dreamweaver (see
Figure 2.17) shows the architecture of the site—a home page (index.html) with major
links to two pages (resume.html and favorites.html).
Figure 2.17
Site map
Now create the home page for your mywebsite Web site. Launch Notepad or another
text editor and type in the tags found on every Web page (see Hands-On Practice 2.1).
In the body of the Web page create the following:
A heading: My Web Site
An absolute link to Yahoo!
Search WWH ::

Custom Search