HTML <a> coordsAttribute

HTML a 标签参考手册HTML <a> Tag

Examples

The following example uses the shape and coords attributes in the <a> element to create an image map:

<object data="planets.gif" alt="Planets" type="image/gif" usemap="#Map1">
<map name="Map1">
<a href="sun.htm.html" shape="rect" coords="0,0,82,126">Sun</a>
<a href="mercur.htm.html"shape="circle" coords="90,58,3">Mercury</a>
<a href="venus.htm.html" shape="circle" coords="124,58,8">Venus</a>
</map>
</object>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Currently, only Firefox and Opera browsers support the coords attribute.


Definition and Usage

HTML5 no longer supports the coords attribute of the <a> tag.

The coords attribute is usually used together with theshapeattribute; the two attributes can specify the size, shape, and position of the link in an <object> or <img> element.

The coordinates of the top-left corner are 0,0.

Tip:To create an image map that works in all browsers, use the<area>element.


Syntax

<a coords="value">

Attribute Values

Value Description
x1,y1,x2,y2 If the shape attribute 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 attribute is set to "circ", this value specifies the coordinates of the circle's center and its radius.
x1,y1,x2,y2,..,xn,yn If the shape attribute is set to "poly", this value specifies the coordinates of each side of the polygon. If the first coordinate and the last coordinate do not match, the browser must add the last pair of coordinates to close the polygon.


HTML a 标签参考手册HTML <a> Tag

Other Extensions