Home > HTML Tags > Links >
     
HTML Tags
Links

HREF

The basic structure of a link to another file or Web page is <A HREF="URL">linked text</A>.

Linking within a document

Suppose your document is long and you want to allow users to go back to the top at frequent intervals. First you insert a named anchor in the HTML file using the form <A NAME="top">anchor text</A>. The anchor text does not show up as a link but is simply a named location where you can send users.

Next you insert links later in your document. You might insert "Back to top" in your text with this command: <A HREF="#top">Back to top</A>. The pound sign (#) tells the browser to look for the named anchor "top."

Linking to anchors on other pages

You also can make links to specific places on other pages if you have inserted named anchors. Suppose you have a table of contents file for a long document and you want to enable users to go directly to particular parts. If you have inserted the anchors "part1", "part2", and so on at the appropriate places in the file document.html, then you can use this command: <A HREF="document.html#part2"></A>.

Link to email

You can make it easy for users to email you with this command:

<A HREF="mailto:wonderfulme@aol.com">Send me mail</A>



Copyright © 1995-2010, Pearson Education, Inc., publishing as Pearson Longman Legal and Privacy Terms