<area>

HTML <area> Tag

The <area> tag identifies the active areas (coordinates, form, size, etc.) of the image-map, defined by the <map> tag. When you click on the active area of the image, a certain action takes place, for example, switching to a page with detailed information.

The <area> tag is always placed inside the <map> tag. Active areas can overlap, in the case of which the area that is higher in the HTML code is activated when clicked.

Syntax

Syntax (语法)

The <area> tag is empty, which means that the closing tag isn’t required. But in XHTML, the (<area>) tag must be closed (<area/>).

Example of the HTML <area> tag:

<!DOCTYPE html>
<html>
 <head>
   <title>Title of the document</title>
 </head>
 <body>
   <p>Click on the logo or on one of the logo item to watch it closer:</p>
   <img src="/uploads/media/news_gallery/0001/01/thumb_316_news_gallery_list.jpeg"  width="250" height="150" alt="block" usemap="#blockmap">
   <map name="blockmap">
     <area shape="circle" coords="50,32,25" alt="html" href="/uploads/media/book_gallery/0001/01/d450f0358f947dffb3af91195c3002600d74101b.png">
     <area shape="circle" coords="218,115,25" alt="css" href="/uploads/media/book_gallery/0001/01/25521e981b34da57c8f51baddc5b76351b855818.png">
     <area shape="circle" coords="195,32,28" alt="php" href="/uploads/media/book_gallery/0001/01/4bbee6698c4884f25c46010d61b658dd62d2c04f.png">
     <area class="homepage" shape="rect" coords="90,90,35,55" alt="php" href="https://www.w3cdoc.com/">
   </map>
 </body>
</html>

Attributes

Attributes (属性)

AttributeValueDescription
alttextSpecifies an alternate text for the active area.
coordsSpecifies the coordinates of the active area.
x1,y1,x2,y2Upper left and lower right corner rectangle (shape=“rect”).
x,y, radiusCenter of a circle and radius (shape=“circle”).
x1,y1,x2,y2,…,xn,ynPolygon vertexes (shape=“poly”).
downloadfilenameIndicates that when you click on a specific area, the file must be downloaded (the user will be prompted to save the file).
mediamedia querySpecifies for which device types the specified URL will be optimized. The value can be any media request.
hrefURLSpecifies the reference for the transition.
hreflanglanguage_codeDefines the language of the document referenced. Used only with the href attribute.
nohrefvalueSpecifies an area that does not contain a reference to another document.Not supported in HTML5.
relEstablishes a link between the current and linked documents.
alternateLink to an alternative version of the document.
authorLink to an author of the document.
bookmarkA permanent link to the document.
helpLink to a document with help.
licenseLink to a page with a licensed agreement or copyrights.
nextLink to the next page/section.
nofollowInstructs some search engines that the hyperlink should not influence the ranking of the link’s target in the search engine’s index.
noreferrerSpecifies that the browser shouldn’t pass the HTTP header, if the user clicked on the link.
prefetchIndicates that one should cache the linked document.
prevLink to the previous page/section.
searchLink to the search for the document.
tagDefines a tag in the current document.
shapeDefines the shape of the area
defaultThe default area (rectangular).
rectRectangular area.
circleThe area in the form of a circle.
polyPolygonal.
targetSpecifies how the linked document should be opened.
_blankIn a new window.
_selfIn the current window.
_topFull width in the window.
_parentIn the parent frame.
frame_nameIn the frameNot supported in HTML5.
typemedia_typeSpecifies MIME-type (specification for transmission over the network of files of various types) of the linked document.

The <area> tag supports also the Global attributes and the Event Attributes.



请遵守《互联网环境法规》文明发言,欢迎讨论问题
扫码反馈

扫一扫,反馈当前页面

咨询反馈
扫码关注
返回顶部