English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The HTML <map> tag is used to define an image map with clickable areas (or hotspots). Within the <map> tag, the <area> tag can be used to create clickable areas, and each clickable area can have an associated hyperlink. This tag is also commonly referred to as the <area> element.
Image map with clickable areas:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Base Tutorial Website (oldtoolbag.com)</title> </head> <body> <img src="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap"> <map name="planetmap"> <area shape="rect" coords="0,0,82,126" alt="Sun" href="sun.html"> <area shape="circle" coords="90,58,3" alt="Mercury" href="mercur.html"> <area shape="circle" coords="124,58,8" alt="Venus" href="venus.html"> </map> </body> </html>Test to see‹/›
IEFirefoxOperaChromeSafari
Al momento, la maggior parte dei browser supporta l'etichetta <map>.
L'etichetta <map> viene utilizzata per le mappe di immagini客户端. Le mappe di immagini sono immagini con aree cliccabili.
L'attributo usemap dell'etichetta <img> deve essere lo stesso del nome dell'etichetta <map>, per stabilire una relazione tra questi due elementi.
L'elemento area è sempre contenuto all'interno dell'elemento map. L'elemento area può definire aree all'interno di una mappa di immagini.
Attenzione: In HTML5, se l'attributo id è specificato all'interno dell'etichetta <map>, allora è necessario specificare anche l'attributo name.
In XHTML, l'attributo name è obsoleto, sostituito dall'attributo id.
Proprietà | Valore | Descrizione |
---|---|---|
name | mapname | Obbligatorio. Nome assegnato all'image-map. |
L'etichetta <map> supporta le proprietà globali, consulta la tabella completa delle proprietà Proprietà globali HTML.
L'etichetta <map> supporta tutti gli eventi Proprietà degli eventi HTML.