Tuesday, February 24, 2009

Basic Of HTML & XHTML Lesson 8

Links to Other Documents on the Web

An abundance of content for your Web site can lead to page and site overcrowding. Determining a way to navigate between pages, or just within a single page, is imperative.

After completing this lesson, you should be able to:

Describe the purpose of a link menu
Explain the functions of anchor tags in Web pages




Creating a Link Menu


Link menus are links on your Web page that are arranged in list form or in some other short, easy-to-read, and easy-to-understand format. Link menus are terrific for pages that are organized in a hierarchy, for tables of contents, or for navigation among several pages.

Web pages that consist of nothing but links often organize the links in menu form.




The idea of a link menu is that you use short descriptive terms as the links, with either no text following the link or with a further description following the link itself. Link menus look best in a bulleted or unordered list format, but you also can use glossary lists or just plain paragraphs.

Link menus enable your readers to scan the list of links quickly and easily, a task that might be difficult if you bury your links in body text.




Linking to Specific Places within Documents


It is also possible to link to a specific place from one page to another with HTML by creating an anchor within the second page. The anchor creates a special element that you can link to inside the page. The link you create in the first page will contain both the name of the file to which you're linking and the name of that anchor. Then, when you follow the link with your browser, the browser will load the second page and then scroll down to the location of the anchor.

Anchors are special places that you can link to inside documents. Links can then jump to those special places inside the page as opposed to jumping just to the top of the page.

You can use links and anchors within the same page so that if you select one of those links, you jump to a different anchor within the page.







Creating Links and Anchors


You create an anchor in nearly the same way that you create a link: by using the tag. If you wondered why the link tag uses an rather than an , now you know: a actually stands for anchor.

When you specify links by using , the link has two parts: the href attribute in the opening tag and the text between the opening and closing tags that serve as a hot spot for the link.













Linking to Anchors in the Same Document

What if you have only one large page, and you want to link to sections within that page? You can use anchors for that link, too. For larger pages, using anchors can be an easy way to jump around within sections.

To link to sections, you just need to set up your anchors at each section the way you usually do. Then, when you link to those anchors, leave off the name of the page itself, but include the hash sign and the name of the anchor. If you're linking to an anchor name called section5 in the same page as the link, href only has to specify section5.





No comments:

Post a Comment