What is an Image Map?
An image map allows you to define clickable areas on an image, each linking to different destinations.
Basic Syntax
HTMLRead-only
1
Area Shapes
| Shape | Description | Coords Format |
|---|---|---|
| rect | Rectangle | x1,y1,x2,y2 |
| circle | Circle | centerX,centerY,radius |
| poly | Polygon | x1,y1,x2,y2,... |
Rectangle Example
HTMLRead-only
1
Circle Example
HTMLRead-only
1
Polygon Example
HTMLRead-only
1
Complete Example
HTMLRead-only
1
Attributes of <area>
| Attribute | Description |
|---|---|
| shape | Defines shape of clickable area |
| coords | Coordinates of the area |
| href | Link destination |
| alt | Alternative text for accessibility |
| target | Where to open the link |
Best Practices
- Always provide alt text for accessibility
- Use accurate coordinates for clickable areas
- Test image maps on different screen sizes
- Keep clickable areas intuitive and clear
- Avoid overly complex shapes
Common Mistakes
- Incorrect coordinates
- Missing usemap attribute
- Forgetting alt text
- Poor responsiveness on mobile devices
Conclusion
HTML image maps allow interactive regions within images. Proper use enhances navigation and user interaction.