The HyperText Markup Language (HTML) anchor tag provides a method for connecting page sections, media files, other websites and generating email because it works with both hyperlinks and anchors. Most websites have various kinds of anchor links, according to the needs of the content. Using the "" HTML tag, you too can make use of this element to enhance your own web documents.
Linking Within a Page
Creating links within a page are especially useful for helping viewers find a page element with ease or when jumping to important sections in a long page.
First, identify the name attribute, or page destination that the link goes to. This attribute does not show any indication that it is linked when published on an HTML page. To create the link, surround the chosen text with the opening and closing anchor tags and enter "name=" followed by the identifier. For example:
First Link
Next, define the anchor that takes the visitor to the destination, once clicked. This particular text will show up as a regular link with blue font and an underline. Enter an opening anchor tag, follow it with both the "href" address attribute and "" number sign and type in the previously selected name attribute. For instance:
Click here to go to the first link.
Linking Text
You can link to an outside URL that directs the visitor to a media file or another website. To do this, obtain the full web address that you want to link to and pick the text that you want to turn into a link. Now, encompass the chosen content within the "" anchor tags and type in the address after the "href" attribute. As an example, to set the destination address to Apple, Inc., type:
Apple, Inc.
Linking Images
In addition to text, graphics can also be used to create connections, such as navigational buttons. To create the graphical link, upload your intended image (in JPG or GIF format) to a server on your web host and make a note of the location. Keep all files in the same directory to make things easier. Enter the graphic's location within the image source tag as such:
Next, create a link to the file by surrounding it with the usual anchor tags. For instance:
Create an Email Address Link
Mail addresses can also be linked using the "mailto" attribute in conjunction with the anchor tag. This type of feature is a great tool to have on your website because, once clicked, the visitor's mail application automatically launches a new message with your email address already in the "To" field. To create an email address link, enter the expected open and close anchor tags around the chosen text, follow it with the "mailto" attribute, type in a colon and fill in your email address. To illustrate: