A bookmark link (commonly called an Anchor link) is useful when your web page is rather long, and users have to scroll down to read it all. You can insert Bookmark links to aid navigation. When users click on your links, they will jump to different section of your web pages. You can even use a bookmark link to jump to a different web page, and back to the same spot where they left.
There are two parts to the bookmark: The clickable link itself, and the place where you want to jump to.
The place where you want to jump to, the destination for the click, again uses the <A> tag. This time, the added attribute is not HREF but ID (it used to be NAME in previous versions of HTML). You then surround some text or image with the tag. Like this:
<A ID = "section1">In</a> this first section, we'll discuss Links
We've surrounded the word "In" with our destination bookmark. The name of the ID itself, the part after the equal sign, can be anything you like. But you'll use that ID in the Link part of the bookmark. Here's the actual link, the part people see and click on.
<A HREF = "#section1">Click here for Section One</A>
Note that we're back to the HREF attribute. This time, after the equal sign, there is a hash/pound symbol ( # ). After the hash symbol you type the ID you used in step one. You then type the text that people will click on. Finally, you close the tag with </A>.
You can add a bookmark to another web page, if you like. In which case, the link would be this:
<A HREF = "page2.html#section2">Click here for Section Two</A>
Note where the hash symbol is now - after the name of a web page. The ID of the destination bookmark follows the hash symbol. There is no space between the two.
The destination link itself would then go somewhere on page2.html. If you had another bookmark on page two, you could have the user jump back to the same spot where they left.
No comments:
Post a Comment