Open In App

HTML | <area> href Attribute

Last Updated : 20 Jul, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The <area> href attribute is used to specify the URL of the target page. When the href attribute is not present in the <area> an element that it will not be a hyperlink.

Syntax: 

<area href="URL">

Attribute Value: 

  • absolute URL: It points to another website.
  • relative URL: It points to a file within a website.
  • anchor URL: It points to an anchor within a page.

Example: 

html




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML area href Attribute
    </title>
</head>
 
<body style="text-align:center;">
    <img src=
        alt="alt_attribute" width="300" height="119" class="aligncenter"
        usemap="#shapemap" />
 
    <map name="shapemap">
         
        <!-- area tag contained image. -->
        <area shape="poly" coords="59, 31, 28, 83, 91, 83" href=
        alt="Triangle">
         
        <area shape="circle" coords="155, 56, 26" href=
        alt="Circle">
         
        <area shape="rect" coords="224, 30, 276, 82" href=
        alt="Square">
    </map>
</body>
 
</html>                   


Output: 
 

  • Before click on specific clickable area: 
     

alt_attribute

  • After click on specific clickable area: 
     

alt_attribute

Supported Browsers: The browser supported by <area> href attribute are listed below: 

  • Google Chrome
  • Edge 12 and above
  • Internet Explorer
  • Firefox 1 and above
  • Safari
  • Opera

 



Similar Reads

How href attribute is different from src attribute in HTML ?
In HTML5, the href and src attributes play distinct roles in defining paths or URLs, each associated with specific HTML elements. The href attribute, commonly found in an anchor (&lt;a&gt;) elements, points to the destination of hyperlinks, facilitating navigation. The src attribute, used with elements like &lt;img&gt; and &lt;script&gt;, specifies
1 min read
HTML DOM Area href Property
The Area href Property in HTML DOM is used to set or return the value of the href attribute. It is used to specify the URL of the area. For example: https://manaschhabra:manaschhabra499@www.geeksforgeeks.org/ (manaschhabra is the username and manaschhabra499 is the password). Syntax: It returns the href property. areaObject.hrefIt is used to set th
2 min read
HTML | &lt;link&gt; href Attribute
The HTML &lt;link&gt; href Attribute is used to specify the URL of the linked document. It mostly contains the URL of the stylesheet file. Syntax: &lt;link href="URL"&gt; Attribute Values: It contains the value i.e URL which specifies the URL of the linked document. Possible values are: absolute URL: It points to another website.Relative URL: iT po
1 min read
HTML href Attribute
HTML href Attribute: It is used to specify the URL of the document. It contains the full address of the page that the user request. It is used to link or connect one document to another document. Supported tags: HTML &lt;a&gt; href AttributeHTML &lt;base&gt; href AttributeHTML &lt;area&gt; href AttributeHTML &lt;link&gt; href Attribute HTML &lt;a
3 min read
HTML &lt;base&gt; href Attribute
HTML &lt;base&gt; href Attribute specifies the base URL for all relative URLs in a document, serving as the reference point for resolving relative links and resources. Syntax:  &lt;base href="URL"&gt;Attribute Values: It contains the value i.e URL which specifies the absolute URL that defines the base URL of the page. for eg."www.geeksforgeeks.org"
1 min read
HTML &lt;a&gt; href Attribute
The HTML &lt;a&gt; href attribute is used to specify the URL of the page that the link points to. When the href attribute is not present in the &lt;a&gt; element, it will not function as a hyperlink. This attribute is essential for creating links to any address and is used in conjunction with the &lt;a&gt; tag. Syntax&lt;a href="URL"&gt; Link text
1 min read
How to hide span element if anchor href attribute is empty using JavaScript ?
The task is to hide the &lt;span&gt; tag when href attribute of &lt;a&gt; tag is not present or invalid. Let us consider we have &lt;a&gt; tag inside the &lt;span&gt; tag. It will look similar to this: &lt;span&gt;&lt;a href="www.google.com"&gt;&lt;/a&gt;&lt;/span&gt; Now we add the id to the elements to identify them. &lt;span id="outer"&gt;&lt;a
2 min read
How to get an element by its href attribute ?
The task is to select the &lt;a&gt; element by its href attribute. A few of the techniques are discussed below. Here we are going to use JQuery to solve the problem. Approach: Use JQuery selector $('a[href=link_to_site]'). Example 1: This example using the approach discussed above. C/C++ Code &lt;script src=&quot;https://ajax.googleapis.com/ajax/li
2 min read
How to set href attribute at runtime?
We know how to set the href attribute of the anchor tag int HTML, but sometimes we may require to set the href attribute at runtime i.e. for example, when a user provides us a url and we want to set it at runtime. We can do this with the help of jQuery. Example 1: In this example, using jquery, we set the attr() method to the url entered by the use
2 min read
HTML5 MathML href Attribute
The href attribute is used to specify the URL of the linked document. This attribute is accepted by all the MathML tags. Syntax: &lt;element href="valid URL"&gt; Attribute Value: href: This attribute is used to specify the URL of the linked document. Below example illustrate the href attribute in HTML5 MathML: Example: &lt;!DOCTYPE html&gt; &lt;htm
1 min read