HTML5 Anchor Tag Example, Definition of <a>anchor tag in HTML5.


 

HTML5 Anchor Tag Example, Definition of <a>anchor tag in HTML5.

In this section, you will learn about the anchor tag of HTML5.

In this section, you will learn about the anchor tag of HTML5.

HTML5 Anchor Tag Example, Definition of <a> anchor tag in HTML5.

In this tutorial, we will introduce you to the <a> anchor tag of HTML5. An Anchor tag is a hyper link. It is used to
create a link from one page to another document like html, video etc. It may be of two types:

1-Internal(within site)
2-External(outside site)
Text written in anchor tag will be colored and underlined.

Attributes of Anchor tag:

1-href
2-target
3-rel (Define relationship)
4-media
5-hreflang (Specify language of target document)
6-type
if herf attribute is not present in anchor tag then other tag is unusable.

Declaration Syntax :

Declaration syntax of anchor tag in Html5.

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

Example of <a></a>in HTML5:

Code:

Anchor.html

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p>Example of anchor tag of HTML5.</p>
<ul>
<li><a   href="http://www.roseindia.net/">RoseIndia.net</li>
</ul>
</body>
</html>

Output:

See the browser compatible page for successfully rendering the program.

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

Download this code

Difference Between HTML5 and HTML4.01:

Anchor tag in HTML5 has some extra attributes which are not supported by HTML4.01, and it does not support
some attributes available in HTML4.01 for example, charset, coords etc.

Ads