
- HTML Home
- HTML Roadmap
- HTML Introduction
- HTML History & Evolution
- HTML Editors
- HTML Basic Tags
- HTML Elements
- HTML Attributes
- HTML Headings
- HTML Paragraphs
- HTML Fonts
- HTML Blocks
- HTML Style Sheet
- HTML Formatting
- HTML Quotations
- HTML - Comments
- HTML - Colors
- HTML - Images
- HTML - Image Map
- HTML - Frames
- HTML - Iframes
- HTML - Phrase Elements
- HTML - Code Elements
- HTML - Meta Tags
- HTML - Classes
- HTML - IDs
- HTML - Backgrounds
- HTML Tables
- HTML - Tables
- HTML - Table Headers & Captions
- HTML - Table Styling
- HTML - Table Colgroup
- HTML - Nested Tables
- HTML Lists
- HTML - Lists
- HTML - Unordered Lists
- HTML - Ordered Lists
- HTML - Definition Lists
- HTML Links
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML Color Names & Values
- HTML - Color Names
- HTML - RGB & RGBA Colors
- HTML - HEX Colors
- HTML - HSL & HSLA Colors
- HTML - HSL Color Picker
- HTML Forms
- HTML - Forms
- HTML - Form Attributes
- HTML - Form Control
- HTML - Input Attributes
- HTML Media
- HTML - Video Element
- HTML - Audio Element
- HTML - Embed Multimedia
- HTML Header
- HTML - Head Element
- HTML - Adding Favicon
- HTML - Javascript
- HTML Layouts
- HTML - Layouts
- HTML - Layout Elements
- HTML - Layout using CSS
- HTML - Responsiveness
- HTML - Symbols
- HTML - Emojis
- HTML - Style Guide
- HTML Graphics
- HTML - SVG
- HTML - Canvas
- HTML APIs
- HTML - Geolocation API
- HTML - Drag & Drop API
- HTML - Web Workers API
- HTML - WebSocket
- HTML - Web Storage
- HTML - Server Sent Events
- HTML Miscellaneous
- HTML - Document Object Model (DOM)
- HTML - MathML
- HTML - Microdata
- HTML - IndexedDB
- HTML - Web Messaging
- HTML - Web CORS
- HTML - Web RTC
- HTML Demo
- HTML - Audio Player
- HTML - Video Player
- HTML - Web slide Desk
- HTML Tools
- HTML - Velocity Draw
- HTML - QR Code
- HTML - Modernizer
- HTML - Validation
- HTML - Color Picker
- HTML References
- HTML - Cheat Sheet
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Character Entities
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
- HTML Resources
- HTML - Quick Guide
- HTML - Useful Resources
- HTML - Color Code Builder
- HTML - Online Editor
HTML - usemap Attribute
HTML usemap attribute creates relationships between <img> and <map> by specifying an image or an object with clickable areas.
The usemap attribute is associated with a <map> elements name or id attribute and creates a relationship between the <img> and the <map>.
Syntax
<tag usemap-"#mapname">
The "mapname" is used to hold the map name containing the hash (#) character.
Applies on
The below-listed elements allow the use of the HTML usemap attribute.
Element | Description |
---|---|
<img> | HTML <img> tag is used to embed image into the HTML document. |
<object> | HTML <object> tag in HTML is used to show multimedia on web pages, including audio, video, pictures, webisite, PDFs, and Flash. |
Examples of HTML usemap Attribute
Bellow examples will illustrate the HTML usemap attribute, where and how we should use this attribute!
Using usemap attribute on "img" Element
On running the below code, the output window will display the image on the webpage. when the user clicks on the respective areas of the image it further displays another image.
<!DOCTYPE html> <html> <body> <h3>HTML usemap Attribute</h3> <p> Click on the computer, the phone, or the cup of coffee to go to a new page and read more about the topic </p> <img src= "https://cdn.pixabay.com/photo/2017/11/27/21/31/computer-2982270_640.jpg" alt="Workplace" usemap="#workmap" width="400" height="270"> <map name="workmap"> <area shape="rect" coords="100,50,200,250" alt="Computer" href= "https://images.unsplash.com/photo-1499951360447-b19be8fe80f5?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80"> <area shape="rect" coords="60,250,150,120" alt="Phone" href= "https://images.unsplash.com/photo-1511707171634-5f897ff02aa9?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8bW9iaWxlJTIwcGhvbmV8ZW58MHx8MHx8fDA%3D&w=1000&q=80"> <area shape="circle" coords="40,50,120" alt="Cup of coffee" href= "https://img.freepik.com/premium-photo/coffee-cup-old-wooden-table-with-cream_158502-63.jpg"> </map> </body> </html>
Using usemap attribute on "object" Element
When we run the below code, it will generate an output consisting of the image along with a text displayed on the webpage.
<!DOCTYPE html> <html> <body> <h1>The object usemap attribute</h1> <object data= "https://img.freepik.com/free-vector/big-animals-set_1284-10911.jpg?w=2000" width="250" height="200" usemap="#animalmap"> </object> <map name="animalmap"> <area shape="rect" coords="30,10,100,100" alt="elephant" href= "https://media.istockphoto.com/id/479667835/photo/background-elephant.jpg?s=612x612&w=0&k=20&c=DwfinIerTq104FXWcBBwegTWcmw8tf18EGqa5IpEyFk="> </map> <p> <b>Note:</b> The usemap attribute of the object element is not supported in Chrome, Edge, Safari, and Opera. </p> </body> </html>
Supported Browsers
Attribute | ![]() |
![]() |
![]() |
![]() |
![]() |
---|---|---|---|---|---|
usemap | Yes | Yes | Yes | Yes | Yes |