Definition of Anchor Text (HTML) in Network Encyclopedia.
What is Anchor Text in computer networking?
Anchor Text, in Hypertext Markup Language (HTML), is a source or target of a hypertext link. An anchor can be either text or a graphic and is specified using the tag formation <A …>…</A>. Anchor tags are fundamental to HTML and make the hypertext concept of linked documents possible.
Without anchor tags, Web pages could not be linked together. There are two types of anchor tag. The first type creates a hypertext link that refers to a document. For example, the following HTML element will display the word “contents” as a hyperlink. If the user clicks on the link, the browser will load the contents.htm page specified in this tag:
<A TARGET="_window2"
HREF="http://www.northwind.microsoft.com/contents.htm">
Contents</A>
The second type of anchor tag marks a portion of text as a destination for a hyperlink. You can place the following element at the end of the contents.htm page:
<A NAME="bottom">This is the end of the page</A>
To load the contents.htm page and jump directly to the bottom of the page, the user needs to click a hyperlink such as this one:
<A TARGET="_window2"
HREF="http://www.northwind.microsoft.com/contents.htm#bottom">
Contents</A>
Anchor Text Is the visible text in a link from a web page. The fallowing link jumps to the home page of this encyclopedia but the visible text is only Computer Network Terms. So, the anchor text is Computer Network Terms.
Anchor in HTML 5
In HTML 5, to create an internal link (to a topic in the same page), you assign a link’s href
attribute to a hash symbol #
plus the value of the id
attribute for the element that you want to internally link to, usually further down the page. You then need to add the same id
attribute to the element you are linking to. An id
is an attribute that uniquely describes an element.
Below is an example of an internal anchor link and its target element:
<a href=”#anchor-in-html5″>Anchor in HTML 5</a>
…
<h2 id=”anchor-in-html5″>Anchor in HTML 5</h2>
When users click the Contacts link, they’ll be taken to the section of the webpage with the Anchor in HTML 5 header element.