How to Use HTML Anchors
Links, or hyperlinks, are the building blocks that connect Web pages together. You create links by using the HTML "<a>" tag -- the anchor tag. Use the "href" attribute inside the anchor tag to specify the destination, which may be on the same HTML page or a different one. You may also specify a location, or bookmark, to direct the link to by using the "name" attribute, or open the destination in a new browser window using the "target" attribute. After opening an anchor tag, enter words or an image to be the link, known as the "link text," then type "</a>" to close the tag.
Instructions
-
-
1
Open an HTML file in a text editor such as Notepad or an HTML editor such as Arachnophilia. Insert the cursor within the "<body>" element of the file where you want to make a hyperlink appear.
-
2
Type the following, substituting the URL for any one you choose, to create a hyperlink that uses text.
<a href="http://www.somewebsite.com/">This is my link.</a>
-
-
3
Type the following, substituting the URL for any one you choose, and substituting the JPG file name for any image located in the same directory as your current HTML file, to create a hyperlink that uses an image.
<a href="http://www.somewebsite.com/"><img src="someimage.jpg"></a>
-
4
Type the following to create a hyperlink that goes to a bookmark anchor on the same HTML page.
<a href="#bookmark">This is my link.</a>
-
5
Insert the cursor somewhere in the same file where you want the link to direct to and type the following to create a bookmark anchor.
<a name="bookmark">
-
6
Type the following to create a hyperlink that goes to a bookmark on a different HTML page.
<a href="http://www.somewebsite.com/otherpage.html#bookmark">This is my link.</a>
-
7
Open "otherpage.html" and insert the cursor somewhere in the file where you want the link to direct to and type the following to create a bookmark anchor.
<a name="bookmark">
-
8
Type the following to create a hyperlink that opens the destination in a new browser window.
<a href="http://www.somewebsite.com/" target="_blank">This is my link.</a>
-
9
Save the files and upload them to your Web server.
-
1