HTML <a> Tag hyperlink :
The <a> tag is used to insert hyperlinks to other pages, or files, locations within the same page, email addresses, or any different URL. You can use both text and image as a hyperlink.
In the browser, hyperlinks differ in their appearance and color. By default, HTML links appear as underlined blue text. When you hover your mouse over a link, it turns red (active link). Links that are already clicked (visited links) become purple.
Definition and Usage
The <a> Tag defines a hyperlink, which is used to link from one page to another.
The most important attribute of the <a>
element is the href
attribute, which indicates the link's destination.
By default, links will appear as follows in all browsers:
- A visited link is underlined and purple.
- An active link is underlined and red.
- An unvisited link is underlined and blue.
<A> tag HTML Attributes:
The <a> tag can have attributes that provide additional information about it.
Syntax:
The <a> tag comes in pairs. The content is written between the opening (<a>) and closing (</a>) tags.
The Href attribute:
The href is a required attribute of the <a> tag. It defines a link on the web page or a place on the same web page, where the user navigates after having clicked on the link. The value of the attribute is either an anchor or a URL. The anchor points to the ID (unique identifier) of the part of the web page referenced. Before the ID we put a hash (#).
It looks like this:
Example of the HTML <a> tag with the href attribute:
Result:
Example of the HTML <a> tag for creating a linked image:
The target attribute:
The target attribute is used to tell the browser where to open the document (by default, links open in the current window).
The target attribute can have the following values:
_blank– opens the link in a new window.
_self-opens the link in a current window.
_parent - opens the document in the parent frame.
_top - opens the document in full width of the window.
Result:
The rel attribute:
This attribute sets the relationship of the current document to the linked one. The attribute values can be as follows:
author- reference to the author of the document or article.
alternate - an alternative version of the document.
bookmark - a permanent link to be used for bookmarks.
nofollow - links to an unendorsed document (this instructs the search engines that the crawler should not follow that link).
Read too:
No follow value:
If you want to create a no-follow link, use rel="nofollow". This informs search engines that you don't support the content at the other end of the link. The Nofollow attribute value is generally used on paid links and advertising. Sometimes the unfollow is considered to be a tag or attribute, but in fact, it’s a value of the rel attribute.
Example of the rel attribute with the "nofollow" value:
Comments :
Post a Comment