Open In App

How to use the shape attribute in the HTML img Tag ?

The “shape” attribute in <img> Tags are used in conjunction with client-side image maps to define the shape of clickable areas within an image. This attribute specifies the shape of the clickable region, allowing developers to create non-rectangular clickable areas such as circles, rectangles, or polygons.

Syntax

<img src="image.jpg" usemap="#map_name" shape="shape_type" coords="coordinates">

Where,

Key Point of Shape Attribute

Key Point Description
Clickable Areas The “shape” attribute defines the shape of clickable areas within an image, allowing users to interact with specific regions of the image.
Shape Types Supported shape types include “rect” (rectangle), “circle”, and “poly” (polygon), each defined by a set of coordinates.
Accessibility Descriptive alternative text should be provided for each clickable area to enhance accessibility for users with disabilities or when images are not displayed.

Features

Article Tags :