YouTip LogoYouTip

Prop Area Coords

HTML DOM Area coords Property\n\nbody {\n font-family: Arial, sans-serif;\n margin: 0;\n padding: raw 0;\n background-color: #f5f5f5;\n}\n.header {\n background-color: #333;\n color: white;\n padding: 10px;\n}\n.container {\n width: 80%;\n margin: auto;\n background-color: white;\n padding: 20px;\n}\npre {\n background-color: #eee;\n padding: 10px;\n border-radius: 5px;\n overflow-x: auto;\n}\ntable {\n width: 100%;\n border-collapse: collapse;\n}\nth, td {\n border: 1px solid #ddd;\n padding: 8px;\n text-align: left;\n}\nth {\n background-color: #f2f2f2;\n}\n.code {\n font-family: monospace;\n background-color: #f9f9f9;\n padding: 2px 4px;\n border-radius:the main 3px;\n color: #c7254e;\n}\n\n
\n

HTML DOM Area coords Property

\n
\n\n
\n\n

HTML DOM Area coords Property

\n\n

Definition and Usage

\n

The coords property sets or returns the value of the coords attribute of an area.

\n

The coords attribute specifies the coordinates of an area in an image map.

\n

Note: The coords attribute is used together with the shape attribute to specify the size, shape, and placement of an area.

\n\n

Browser Support

\n\n\n\n
PropertyGoogle ChromeInternet ExplorerFirefoxSafariOpera
coordsYesYesYesYesYes
\n\n

Syntax

\n

Return the coords property:

\n
areaObject.coords
\n

Set the coords property:

\n
areaObject.coords = value
\n\n

Property Values

\n\n\n\n\n\n
ValueDescription
x1,y1,x2,y2Specifies the coordinates of the top-left and bottom-right corner of the rectangle (for shape="rect")
x,y,radiusSpecifies the coordinates of the circle center and the radius (for shape="circle")
x1,y1,x2,y2,..,xn,ynSpecifies the coordinates of the edges of the polygon. If the first and last coordinate pairs are not the same, the browser must add the last coordinate pair to close the polygon (for shape="poly")
\n\n

Technical Details

\n\n\n\n
Return Value:A String, representing a comma-separated list of coordinates
DOM VersionCore Level 2
\n\n

More Examples

\n

Example

\n

Change the coordinates of a circular area to (90,58,3):

\n
<img src="planets.gif" width="145" height="126" usemap="#planetmap">\n<map name="planetmap">\n  <area id="venus" shape="circle" coords="90,58,3" alt="Venus" href="venus.htm">\n</map>\n\n<script>\ndocument.getElementById("venus").coords = "90,58,3";\n</script>
\n\n

Try it Yourself Β»

\n\n

Example

\n

Return the coordinates of a circular area:

\n
var x = document.getElementById("venus").coords;
\n

The result of x will be: 90,58,3

\n\n

Try it Yourself Β»

\n\n

Related Pages

\n

HTML reference: HTML <area> coords attribute

\n\n
← Prop Area HashProp Area Alt β†’