ometimes, we have a lot of information to put on a web page and may need to link to an area on that same page so that our visitors can find the information they need.
ow the anchor tag can also take your visitors to another area of your web page. That's right. You can link from the top of your page to the middle, bottom, or wherever on your page you so desire. Using the NAME attribute, you can simply jump users to another location on the same page. The NAME attribute labels the destination of the link with an anchor name. We'll name it "part2." Go to the destination text and surround it with the tags <A NAME="part2"> and </A>. Then go to the text you want to link from and surround that text with the link tags <A HREF="#part2"> and </A>. Now when someone clicks the link, he or she will be taken to the link further down on the page. First, let's look at how the code is written:
This creates a target location within a document
This links to that target location from elsewhere in the document
kay, let's pretend that I'm talking about how you can contact me by using my e-mail and am trying to point you to an area on this page where you can find it. The easiest way to do that would be to put a link right here that will take you to the bottom of the page near my e-mail address. So we need to put the address up here. And we do that by creating the link like this:
Then our next step would be to give that area of the page a name, such as "MAIL", and you write that somewhere below in the vicinity of the e-mail address. You write it like this:
Okay now, let's try it out. You should easily identify the A NAME part of the link at the bottom of the page. This is my A HREF part of the link:
That wasn't so bad, was it? Well, now it's time to go on with the next part of the lesson. Let's talk about e-mail.
<a href="mailto:?"> creates a mailto
</a> closes a mailto
ot every link on the Web leads to another Web page. Some of them link to someone's e-mail address. This type of link is known as a "mailto,". When creating a mailto link, you sandwich the linked words with these tags:
<a href="mailto:e-mail_address"> and </a>.
After the words "mailto:", you put in the e-mail address that the link will send mail to. If your email address were firstname.lastname@example.org, your HTML would read:
<a href="mailto:email@example.com"> E-mail me!</a>
And the page would appear like this:
And yes, you can really e-mail me from this link.
n between those two tags, the opening and closing tags (in this case also called anchors, you write whatever you want your readers to see, such as "E-mail me" or "Hey you! Mail me from here!" Actually, you can write whatever you want to or even use an image -- a button, for instance. You link images in the same way you did in a previous lesson.
hat's all there is to it! And the next lesson? We'll work on lists. So whenever you're ready...
Lesson 8 -- Next