area href Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:area

Description

The href attribute specifies the hyperlink target for the area.

Attribute Values

Value Description
URL Specifies the hyperlink target for the area.

Possible values:

Item Example
An absolute URL - points to another web site href="http://www.example.com/")
A relative URL - points to a file within a web site href="a.htm"
Link to an element with a specified id within the page href="#top")
Other protocols https://, ftp://, mailto:, file:, etc..
A scripthref="javascript:console.log('Hello');

An image-map, with clickable areas:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<img src="https://www.java2s.com/style/demo/Opera.png" width="145" height="126" alt="message" usemap="#myMap">

<map name="myMap">
  <area shape="rect" coords="0,0,80,100" alt="S" href="http://java2s.com">
  <area shape="circle" coords="90,60,5" alt="M" href="http://java2s.com">
  <area shape="circle" coords="130,60,10" alt="V" href="http://java2s.com">
</map><!--from  w  w w  .  ja  va 2  s.  c o m-->

</body>
</html>

Related Tutorials