Anchor tag attributes in HTML5, Define the href attribute of anchor tag.


 

Anchor tag attributes in HTML5, Define the href attribute of anchor tag.

In this section, we will see how to use href attribute in anchor tag.

In this section, we will see how to use href attribute in anchor tag.

Anchor tag attributes in HTML5, Define the href attribute of anchor tag.

In this tutorial, we will see the use of href attribute of anchor tag . The href attribute of anchor tag holds URL of destination document, which we want to visit. URL is a address of required file or document.
If href attribute is not available in anchor tag, it works as a placeholder of  hyperlink.

href Attribute :
Attribute Value Description
href URL
(Address of destination document)
 Define the address of required file.
      Absolute Address(URL)-: another site.
       Relative Address(URL)-: within site.


Declaration Syntax :

Declaration syntax of href attribute in anchor tag.

                           <a href="url">Text Area</a>

Example Of href attribute of anchor tag:

Code:

hrefAttributeTag.html

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<b>Example of anchor tag href attribute.</b><ul>
<li>
<a href="http://www.roseindia.net/" hreflang="en">
Go to Rose India site.</a></li>

</ul>
</body>
</html>
Output:

Note: See the browser compatible page for successfully rendering the program.

Download this code

Ads