Table of Contents
How does area Tag work in HTML?
Attributes
1. Tag-Specific Attributes
2. Standard Attributes
3. Global Attributes
Examples to Implement Area Tags in HTML
Example #3
Conclusion
Home Web Front-end HTML Tutorial Area Tag in HTML

Area Tag in HTML

Sep 04, 2024 pm 04:31 PM
html html5 HTML Tutorial HTML Properties HTML tags

In this article, we will learn about Area Tag in HTML. Area Tag defines a hotspot in an image map and associates or links with a hypertext reference to allow a user to be clickable on the web page. It helps link the different pages while a map portion is clicked. And a tag becomes useful when there is a need for multiple links on the image.

Syntax

The basic syntax is given below:

<area alt="text" class=" " coords=" " shape> ;

Here alt is used for alternate text if an image is not rendered.

  • class: Defines a class name for an element.
  • coords: Has a set of values for the shapes.

With an image map, the syntax is:

<img  src="/static/imghw/default1.png" data-src="edu.jpg" class="lazy" area tag in html="# name" alt="Area Tag in HTML" >
<map name=" name">
<area shape="shapeName1" coords="x,y coordinates" href="html%20linkPath">
<area shape="shapeName2" coords=" x,y coordinates " href="htmllinkPath">
</map>

Explanation: This is an empty tag with no closing tags, whereas, in the case of XHTML, it is declared as . And this area tag is always embedded with tag (included in the map container), which gives the coordinates values of the specific image. And also, an overlapping takes place inactive areas; it is resolved by giving priority to the higher area is activated. The following portion covers how to use the area tag with an example and Brower compatibility and supported attributes by them.

How does area Tag work in HTML?

Here is the process to make it through; initially, the image in the image map.

1. To insert an image to the page, we are supposed to use an image tag which is given below:

<img src="/static/imghw/default1.png" data-src="edu.jpg" class="lazy" alt="Area Tag in HTML logo"> // image from the saved folder. Also, we can get from the web URL directly and map with <map> tag.</map>

It comes with src attributes: Source and alt-text describing the image content.

2. Secondly, open the map element with the attribute #map. This image tag comes with a use map followed by the ‘#’ symbol (use map =” #map”). Mapname should be the same name as the Area Tag in HTML.

How to create an image map? Using map and name attributes together to have images and maps together. The browser recognizes the area of the shape when the mouse cursor over the screen becomes a pointer(hand symbol).

3. To declare the areas that are to be used to map.

<area shape="rect" cords='…….href="" ' alt="">
href comes with alt attribute by default.

Attributes

In general, HTML tags have one or more attributes that help show the browser visually pleasant. There are three varieties of attributes used, namely global, event handling, and element-specific attributes. The area tag contributes tag-specific attributes, and a description of them, which are listed below, and the HTML 5 has some new attributes.

1. Tag-Specific Attributes

Name of Attributes  Description                  Example
alt Defines an alternate text in the specified area which improves accessibility. ”hello”
href Defines the hyper reference means a link to the next page points/ URL of a Page. It changes an area into a hyperlink. document”
shape  Defines the different shapes to be done on the image. ”First

”Second

coords Gives the specific values appropriate to the region in the image. The  Coords are specified as follows :

Default: no cords required.

Rect: left, top, right, bottom

Circle : x , y ,radius

Poly: x1,y1, x2,y2,x3,y3…

document”
target Specifies where to open the link page, or I can say the end target page. ”
Nohref Defines that absence of href. This means the area doesn’t have a link to next page
type Specifies the content type (MIME) ”Authors
hreflang Specifies language-type ”Second

2. Standard Attributes

The description of these attributes has already been discussed in the previous article.

  • Access key
  • class
  • dir
  • id
  • Style
  • lang
  • id
  • tab index
  • title.

3. Global Attributes

  • onmouse down
  • onmouse up
  • onmouse over
  • onmouse move
  • onmouse out
  • on focus
  • on blur
  • onkey press
  • onkey down
  • onkey up.

Examples to Implement Area Tags in HTML

Below are examples of implementing area tags in HTML:

Example #1

In the below example, I have created a jpg image diary.jpg. When u execute the code, the hand tool moves over the image at the specified cords; when you click on it, it directs you to the page rr.html.

Code:



<img  src="/static/imghw/default1.png" data-src="diary.jpg" class="lazy" area tag in html="#Diary" alt="Area Tag in HTML" >
<map name="Diary">
<area shape="rect" coords="94,91,189,193" href="rr.html">
</map>

Code: rr.html



hello

 Online tutorial Class

Output:

Area Tag in HTML

Example #2

Code:



<img class="logo lazy" src="/static/imghw/default1.png" data-src="edu.jpg" alt="Area Tag in HTML logo"    style="max-width:90%"  style="max-width:90%" area tag in html="#ccmap">
<map name="ccmap">
<area shape="rect" coords="89,9,294,50" href="sha.html" alt="Area Tag in HTML">
<area shape="rect" coords="297,7,407,54" href="rr.html" alt="Welcome">
</map>

Code: rr.html



hello

 Online tutorial Class

Code: sha.html



hello

 Welcome to the Page

Output:

Area Tag in HTML

The Output below shows the logo of Area Tag in HTML; clicking the word BA directs to the page Hello page.

Area Tag in HTML

Example #3

Code:



<img src="/static/imghw/default1.png" data-src="new.png" class="lazy" alt="Area Tag in HTML" border="0" area tag in html="#Protocols">
<map name="Protocols">
<area shape="Poly" coords="74,0,113,29,98,72,52,72,38,27" href="https://www.manageengine.com/network-monitoring/what-is-snmp.html%22" alt="SNMP Tutorial" target="_blank">
<area shape="rect" coords="22,83,126,125" alt="FTP Tutorial" href="https://www.techtarget.com/searchnetworking/definition/File-Transfer-Protocol-FTP" target="_blank">
<area shape="circle" coords="73,168,32" alt="http Tutorial" href="https://www.webopedia.com/TERM/H/HTTP.html" target="_blank">
</map>

Explanation of the above program: In this example, we have created an image map using the image file called new.png, which has three clickable areas declared within it using the tag. The first clickable area is a polygonal shape that links to the SNMP page called www.managengine.com. The second clickable area is a rectangular shape that links to the FTP page called www.searchnetworking.com, and finally, the last clickable area is a circle that links to an HTTP page called www.webopedia.com.

Output:

Area Tag in HTML

Output:

Area Tag in HTML

Conclusion

Therefore, we have seen how the area tag is used in active areas in switching to the pages with brief information explaining how to use the tag in clickable areas with syntax and demo examples.

The above is the detailed content of Area Tag in HTML. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to restrict file types for an upload input in HTML How to restrict file types for an upload input in HTML Aug 24, 2025 am 02:57 AM

Use the accept attribute to limit the upload type of HTML file, such as accept="image/*" only allows images, accept=".pdf" only allows PDF, accept=".doc,.docx,.pdf,.txt" allows multiple specified types, and can combine JavaScript to verify file types to improve user experience, but security verification must be performed on the server side, because the accept attribute is not secure and the browser supports are different, and it is only used to improve availability rather than replace server verification.

How to disable a form element in HTML How to disable a form element in HTML Aug 30, 2025 am 08:45 AM

To disable HTML form elements, you can use the disabled attribute, which can prevent user interaction and the element value will not be submitted with the form. This attribute is of a Boolean type and can be directly added to form element tags such as input, textarea, select, or button. For example, it can also be dynamically controlled through JavaScript, such as document.getElementById("myInput").disabled=true. If the element cannot be edited but the value is still submitted, you should use the readonly attribute. The disabled attribute is simple and effective and widely supported.

How to use the HTML5 contenteditable attribute How to use the HTML5 contenteditable attribute Aug 23, 2025 am 09:55 AM

ThecontenteditableattributemakesHTMLelementseditablebyaddingcontenteditable="true"toelementslikediv,p,orh1–h6.2.UseJavaScripttoretrievecontentviainnerHTMLforformattedtextortextContentforplaintext.3.Listenforchangesusingtheinputeventtocaptur

How to add a favicon to your website with HTML5 How to add a favicon to your website with HTML5 Aug 27, 2025 am 02:35 AM

To add a website favicon correctly, first prepare a 32×32 or 64×64 pixel .ico, .png or .svg format icon file and name it favicon.ico, etc., place it in the website root directory or a specified path, and then use a clear statement in the HTML tag. For example: It is recommended to support multiple formats and devices at the same time, such as adding PNG different size versions, SVG icons, and Apple touch icons. Finally, clear the cache and test whether it displays normally, to ensure that the path is correct and the file is accessible. The entire process requires attention to the file format, path and compatibility to avoid loading failure.

What is the placeholder attribute's purpose in HTML5? What is the placeholder attribute's purpose in HTML5? Aug 31, 2025 am 06:58 AM

Theplaceholderattributeprovidesashorthintininputfieldsthatdisappearswhentypingbegins;1.Itisusedinandelementstoshowexampletextlike"Enteryouremail";2.Thehintisdisplayedonlywhenthefieldisemptyandstyledfaintlybybrowsers;3.Itdoesnotreplacetheele

What is the importance of the alt attribute for images in HTML5? What is the importance of the alt attribute for images in HTML5? Aug 27, 2025 am 02:29 AM

Thealtattributeisessentialforaccessibility,SEO,anduserexperience;1.Itenablesscreenreaderstodescribeimagestovisuallyimpairedusers,ensuringcontentcomprehension;2.Itdisplaysfallbacktextwhenimagesfailtoload,maintainingcontext;3.ItimprovesSEObyhelpingsear

What is ARIA in HTML for accessibility? What is ARIA in HTML for accessibility? Aug 27, 2025 am 04:57 AM

ARIAisneededtoenhancewebaccessibilityfordynamiccontentandcustomUIcomponentsthatlacknativeHTMLsemantics.1)ARIArolesdefineanelement’spurpose(e.g.,role="dialog").2)ARIApropertiesdescribecharacteristics(e.g.,aria-label,aria-describedby).3)ARIAs

How does Content Security Policy (CSP) work with HTML5? How does Content Security Policy (CSP) work with HTML5? Aug 30, 2025 am 01:29 AM

CSPenhancesHTML5securitybydefiningtrustedcontentsourcestopreventXSS,clickjacking,andcodeinjection.1.Itrestrictsinlinescriptsandstylesbyblockingthemunless'unsafe-inline',nonces,orhashesareused.2.Itcontrolsexternalresourcesviadirectiveslikescript-src,i

See all articles