Latest web development tutorials

HTML <a> coords attribute

HTML a Tag Reference HTML <a> tag

Examples

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

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

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

At present, only Firefox and Opera browsers support coords attributes.


Definition and Usage

HTML5 is no longer supported coords attribute <a> tag.

coords attribute usually associated with shape together using the property, two attributes can be specified <object> or <img> element links the size, shape and location.

The coordinates of the upper left corner is 0,0.

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


grammar

<a coords="value">

Property Value

value description
x1, y1, x2, y2 If the shape attribute is set to "rect", then the value of the upper left corner of the rectangle specified coordinates and the lower right corner.
x, y, radius If the shape attribute is set to "circ", the predetermined value of the center coordinates and radius.
x1, y1, x2, y2,.., xn, yn If the shape attribute is set to "poly", then the value of the specified coordinates of each polygon edges. If the first and last coordinate coordinates do not match, in order to close the polygon, the browser must add the last pair of coordinates.


HTML a Tag Reference HTML <a> tag