html tutorial - href Attribute in HTML - html5 - html code - html form

Learn html - html tutorial - Href attribute in html - html examples - html programs
- The href is stands for Hypertext REFerence. The href attribute is used to specify the URL of the linked resource.
- To highlight the specific word for the reference we use href and it will be highlighted as a hyperlink.
Syntax for href attribute in HTML:
<a href="URL">
Applies To:
Elements | Attribute | Definition |
---|---|---|
<a> | href | To specify internal or external link. |
<area> | href | To specify internal or external link. |
<base> | href | To specify all relative URLs on a page will be referred. |
<link> | href | To specify external resource link. |
href Attribute Value:
Value | Description |
---|---|
URL | URL is used to specify the location of the link. |
Sample Coding for href Attribute in HTML:
Tryit<!DOCTYPE html>
<html>
<head>
<title>Wikitechy href attribute</title>
</head>
<body>
<a href="http://www.wikitechy.com">Click here</a>
</body>
</html>
Code Explanation for href Attribute in HTML:

- <a> anchor tag is used to define a hyperlink.
- href attribute is used to specify the URL of target location.
- “http://www.wikitechy.com” is the URL of target location.
- “Click here” text will be visible to the user.
Output for href Attribute in HTML:

- If user click on the “Click here” text it will navigate to wikitechy.com website.
- The output shows the www.wikitechy.com web page

Browser Support for href Attribute in HTML:
![]() |
![]() |
![]() |
![]() |
![]() |
---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes |