Coords Attribute Type


 

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

Specific Attributes with Type Coords

  1. coords:
    This is declared on the elements: a, area

Common Attributes with Type Coords

There are no Common Attributes with type Coords.


Attribute Value for 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:

ShapeValue of coordsExplanation
rectx1, 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
circlex, y, radius(x, y) are the coordinates of the centre of the circle, radius is in pixels
polyx1, y1, x2, y2, x3, y3, ... xn, yneach (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".


Page Footer & Copyright

Copyright © Sally Maughan 2005-2009 (Page last updated on 01 Oct 2009)

*Valid XHTML 1.1 - hosted by *Openstrike

Content based on the W3C Working Draft: *XHTML 1.1 and Recommendation: *XHTML Modularisation 1.1.

W3C, XHTML, XML, HTML, CSS and MathML are *Trademarks of the W3C (*MIT, *ERCIM, *Keio) with which the site's author has no connection.


Up, Next & Previous Links

Your Location

Home > XHTML 1.1 Home > Data Types in XHTML 1.1 > Attribute Types (XHTML 1.1) > Coords Attribute Type