HTML5 a Tag

HTML5 A Tag is useful for providing link to other resources. 

HTML5 A Tag Example:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>HTML5 A Tag</title>
</head>
<body>
   <a href="www.apekshit.com">JAVA Tutorial For Beginner</a>
</body>
</html>

Output: JAVA Tutorial For Beginner

As you can see above, A tag is useful for providing link to other webpage or resources.

href Attribute: href attribute in a tag or anchor tag is used to provide a link. Link can be absolute or relative to the current resource.

target Attribute: target attribute in a tag or anchor tag is used to define the target page. If you want to open the target page in new window, target="_blank" will open the link in a new window.

Any content between <a> and </a> tag will be displayed on the webpage with link on it.

Difference between HTML and HTML5 A Tag:

In HTML, A Tag was used either as an anchor tag or as a hyperlink. In HTML5 A Tag can be used only as hyperlink. If href attribute is not present in A Tag, it is considered as a placeholder for hyperlink.

comments powered by Disqus