The Coords Attribute Type is a data type defined by XHTML Modularisation 1.1, declared in the DTD as XML 1.0 type CDATA.
Reference: *W3C - XHTML Modularisation 1.1 - Attribute Types
There are no Common Attributes with type Coords.
Numerical coordinates specifying the dimensions and position of a shape (all x and y coordinates are measured from the top left corner of the image)
The Coords Attribute Type is used in conjunction with the Shape Attribute Type in order to specify a region within an image map created using the Client-side Image Map Module.
Example coordinates for the basic shapes are given in the table below:
| Shape | Value of coords | Explanation |
|---|---|---|
| rect | x1, y1, x2, y2 | (x1, y1) are the coordinates of the top left hand corner of the rectangle (x2, y2) are the coordinates of the bottom right corner of the rectangle |
| circle | x, y, radius | (x, y) are the coordinates of the centre of the circle, radius is in pixels |
| poly | x1, y1, x2, y2, x3, y3, ... xn, yn | each (xn, yn) pair specifies one of the corners of the polygon |
The x coordinate is the horizontal distance from the left of the image in pixels. The y coordinate is the vertical distance from the top of the image in pixels.
For the "poly" shape, the arbitrary number of x,y points specified are joined, in order, by straight lines to form the polygon. A line is also created between the last point and the first point, if they differ.
Note: Although, in theory, percentage coordinates are allowed, I am not aware of any browser which interprets these coordinates correctly. Most just act as though the percentage signs were not present and treat any percentage values as pixel values - i.e. a coordinate pair of "50%,20%" is treated exactly the same as "50,20".