Ad

HTML Hyperlink | a Tag

A web page can contain various links that redirect you to other page, these links are known as hyperlinks. Hyperlinks allow visitors to navigate between web pages or websites by clicking on a word or an image.

A hyperlink is specified using an HTML tag <a>, this tag is known as an anchor tag, and anything between the opening <a> and closing </a> tag becomes part of the hyperlink. When a user clicks on that part, the linked document will be opened or downloaded.

Attributes: Anchor tag
AttributeDescription
hrefStands for Hyperlink REFerence, use it to specify the file name to be linked.
target Specifies where to open the linked document. Its values are:
_blank: Specifies to load the linked file into a new blank window/tab.
_self: Load the file into the same tab window in which the linked text was clicked on.
The default target value is _self.
title The title attribute is used to provide a tooltip on the hyperlinked.
style Specifies an in-line style for the tag. Using the style attribute, you can decorate the hyperlinked text underline:
text-decoration: none; | overline; | line-through; | underline;
HTML Hyperlink syntax:
<a href="home.html"> Hyperlink Text Here </a>
<a href="home.html" target="_blank"> Hyperlink Text Here </a>
<a href="home.html" title="Click Me"> Hyperlink Text Here </a>
<a href="home.html" style="text-decoration: none;"> Hyperlink Text Here </a>

When you move the mouse over a hyper linked text, the mouse arrow will changed into a small hand. By default, an unvisited link is blue in color, when you click on it, the link will be visited and turned into purple color, and when you press and hold the mouse button, the link becomes active until you release the button, An active link is red in color with an underline.

Create a Bookmark

HTML bookmark is used to create links in the same page on a particular section. Bookmarks is useful when your webpage is very long and content many different sections. When you click on the link, the page will scroll up or down to the location where the bookmark is placed.

For example:
<h2 id="bookmark">Bookmark</h2>
Then, add a link to the bookmark
<a href="#bookmark">Jump to Bookmark</a>

In the above example, when you click on 'Jump to Bookmark' the page will find the elements id 'bookmark' and scroll to focus the text.

You can also link the bookmark from another web page, by giving the page URL followed by id. For example: <a href="html-hyperlink.html#bookmark">Jump to Bookmark</a>

Ad: