How to Create Anchor Text Links With HTML
If you are creating a simple, basic website, there is generally no need for anchor text links within it. However, larger and more complex sites, such as reference sites or sites that cover multiple subject areas, can benefit from anchor text links as a means of helping your visitors navigate the site more easily. Anchor text links work in much the same way as normal links, but they can operate entirely within a single page.
Instructions
-
-
1
Locate the text in your HTML document to which you want the anchor link to direct your viewer.
-
2
Create an anchor tag around this text. It should look like this: <a>text</a>. This will mark the specific text you will link to, so only surround a word or two with the anchor tag, rather than an entire block of text.
-
-
3
Insert an id attribute into the opening anchor tag. To do this, write id="" in between the first "a" and the closing bracket, with a space in between the "a" and the new code, so it looks like this: <a id="">.
-
4
Name the anchored text and write this name in between the quotation marks. It is generally best to use a single-word, descriptive name in all lowercase to keep things simple and prevent possible confusion when you create links to the anchor. At this point, your anchor is complete and should look like this: <a id="name">text</a>.
-
5
Link to the anchor elsewhere in the page by creating a hyperlink as normal: <a href="">text or image</a>. In between the quotation marks, in place of an external page URL, write in a hash mark and the name of the anchor (with no space in between), so it looks like this: <a href="#name">text or image</a>.
-
6
Link to the anchor from another page by following the same process, except including the full URL of the page the anchor is on immediately before the hash mark.
-
1
References
- Photo Credit Jupiterimages/Brand X Pictures/Getty Images