The HTML Anchor Tag Coords Attribute is used with the HTML Anchor Tag Shape Attribute to define or specify the shape, size and the location or placement of the link in an <object> or <img> element.
By default, the top left corner coordinates are taken as 0,0.
Syntax of HTML Anchor Tag Coords Attribute
< a coords=”value”>
HTML Anchor Tag Coords Attribute Values
Coords Attribute Value | Description of Value |
x1,y1,x2,y2 | If the shape attribute in the anchor tag is set to “rect” then these coordinates define the top left and the bottom right corner of the rectangle. |
x,y,radius | If the shape in the anchor tag is set to “circle” then these coordinates specify the center of the circle and the radius of the circle. |
x1,y1,x2,y2, … x(n),y(n) | If the shape attribute in the anchor tag is set to “poly” then these coordinates specify the edges of the polygon. |
HTML Anchor Tag Coords Attribute Example
HTML Anchor Tag Coords Attribute Code | Output |
<p>Click on the shapes to watch them:</p> <img src=" HTMLAreaTagEx.gif" alt="Shapes" usemap="#shapemap" width="145" height="126"> <map name="shapemap"> <a shape="circle" coords="25,30,12" href="Circle.jpg" target=_blank> <a shape="rect" coords="62,30,82,40" href="triangle.jpg" target=_blank > <a shape="circle" coords="115,35,10" href="star.jpg" target=_blank > </map> |
Click on the shapes to watch them: |
In the above Anchor Tag Coords Attribute example, notice the usage of Coords attribute to define the coordinates of link locations.
HTML Anchor Tag Coords Attribute Supporting Browsers
S. No. | Browser | Supported(Yes/No) |
1 | Internet Explorer | No |
2 | Firefox | Yes |
3 | Google Chrome | No |
4 | Opera | Yes |
5 | Safari | No |
Also the coords attribute is not supported in HTML 5.