Links on your page will allow your visitors to visit other pages
on your site and any other page on the web very easily. When text is marked as a link, it will be underlined and have a different color from the rest of
the text.
Setting Link Colors
We can set the color of the link by adding the LINK="color"
attribute to the BODY tag by using the colors in the color chart. Here is what the tag will look like:
<BODY BGCOLOR="#000000" BACKGROUND="picture.jpg"
TEXT="#FFFFFF" LINK="#FFCCFF">
We can also use a different color for the link once that page was viewed
by using the visited link, VLINK="color", attribute. This allows visitors to see which
pages they have already visited:
<BODY BGCOLOR="#000000" BACKGROUND="picture.jpg"
TEXT="#FFFFFF" LINK="#FFCCFF" VLINK="#009966">
We can also set the color of an active link, a link that is being clicked, by using the attribute ALINK="color":
<BODY BGCOLOR="#000000" BACKGROUND="picture.jpg"
TEXT="#FFFFFF" LINK="#FFCCFF" VLINK="#009966" ALINK=="blue">
Creating Links
To create a link we use the tag <A HREF="page">. If you are
just creating a link to a page within your own site just use the name of the
page. Here are several examples:
- <A HREF="page.html">
- <A HREF="main.html">
- <A HREF="menu.html">
- <A HREF="page2.html">
Creating links to pages outside of your site uses the same tag except
the whole URL is used. Here are several examples:
- <A HREF="http://www.pitt.edu">
- <A HREF="http://www.somewhere.com">
- <A HREF="http://page.link.com">
- <A HREF="ftp://ftp.pitt.edu">
- <A HREF="ftp://ftp.site.com">
This tag alone will not create the link. We need to add the text to be clicked on for the link. The tag
<A HREF="page"> is followed by the text that is to be the anchor or link.
To show where the anchor ends we use the ending tag </A>. This is
how you will write the code:
- <A HREF="page">Enter text here</A>
Here are several examples:
- <A HREF="page1.html">Enter My Page Here!</A>
- <A HREF="page2.html">Here is a page about HTML!</A>
- <A HREF="http://search.yahoo.com">Yahoo! Search</A>
- <A HREF="http://webtutor.iwarp.com">WebPage Tutor</A>
We can also embed a link in the middle of a sentence:
- To find out how to use graphics as links read <A
HREF="graphic.html">Adding Graphics</A>.
Here is what the link will look like:
Email Links
We can also use this tag for email. All sites have a link to email the author of the page. This allows the author to know if
there are any problems with the page, or if visitors have any comments or suggestions.
Instead of using "page" we use "mailto:emailaddress@somewhere.com". This
is how the tag will look:
- <A HREF="mailto:email@somewhere.com">Email</A>
Here is what it will look like (**note this is not a valid email
address to send mail to!):
Opening a New Browser Window
Suppose we have a link that we want to open in another browser instead of in the same window. This can be done easily by adding the attribute TARGET inside of the link tag. The TARGET attribute is set equal to the name of the new browser window which is usually "_win". Here is how it works:
To find out how to use graphics as links read <A HREF="graphic.html" TARGET="_win">Adding Graphics</A>.
Try it out to see how it works!
To find out how to use graphics as links read Adding Graphics.
This page has been accessed
times since June 24, 2001
Last Updated March 21, 2001
|