HTML coords property
Example
An image map with clickable areas:
<
img
src
=
"
planets.gif
"
width
=
"
145
"
height
=
"
126
"
alt
=
"
Planets
"
usemap
=
"
#planetmap
"
<
map
name
=
"
planetmap
"
<
area
shape
=
"
rect
"
coords
=
"
0,0,82,126
"
href
=
"
sun.htm
"
alt
=
"
Sun
"
<
area
shape
=
"
circle
"
coords
=
"
90,58,3
"
href
=
"
mercur.htm
"
alt
=
"
Mercury
"
<
area
shape
=
"
circle
"
coords
=
"
124,58,8
"
href
=
"
venus.htm
"
alt
=
"
Venus
"
mapTry it »
Browser support





All major browsers support the coords property.
Definition and Usage
The coords property specifies the x and y coordinates of the area.
The coords property is used together with the shape property to specify the size, shape, and position of the area.
Tip: The coordinates of the top-left corner of the image are "0,0".
Differences between HTML 4.01 and HTML5
NONE.
Syntax
Attribute values
| Value | Description |
|---|---|
| x1,y1,x2,y2 | If the shape property is set to "rect", this value specifies the coordinates of the top-left and bottom-right corners of the rectangle. |
| x,y,radius | If the shape property is set to "circ", this value specifies the coordinates of the center and the radius of the circle. |
| x1,y1,x2,y2,..,xn,yn | If the shape property is set to "poly", this value specifies the coordinates of each vertex of the polygon. If the first and last coordinates do not match, the browser must add the last pair of coordinates to close the polygon. |
HTML tag