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



Href attribute in html

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:

href Attribute Code Explanation

  1. <a> anchor tag is used to define a hyperlink.
  2. href attribute is used to specify the URL of target location.
  3. “http://www.wikitechy.com” is the URL of target location.
  4. “Click here” text will be visible to the user.

Output for href Attribute in HTML:

href Attribute Output

  1. If user click on the “Click here” text it will navigate to wikitechy.com website.
  2. href Attribute Output
  3. The output shows the www.wikitechy.com web page

Browser Support for href Attribute in HTML:

Yes Yes Yes Yes Yes

Related Searches to href Attribute in html