coords

coords 属性 (HTML)

a 要素・area 要素 coords 属性 (HTML, XHTML 1)

[1] HTMLa 要素および area 要素の coords 属性は、 領域の位置と形を指定します。

[2] 仕様書: HTML 4 IW:HTML4:"struct/objects.html#adef-coords"

属性値

[3] この属性の値は %Coords です。 SGML 的には CDATA です。

[4] この属性は省略可能です。

仕様書には明記されていませんが、 area の場合 shapedefault 以外なら必須、 a の場合 default の場合と画像写像の領域にしない場合以外は必須と思われます。 (そうしなければ意味を成しません。)

歴史

大域属性としての使用

[9] XHTML2 では src大域属性化に伴い coords 属性大域属性となりました。

[10]

<html xmlns="http://www.w3.org/2002/06/xhtml2">
   <head>
      <title>The cool site!</title>
   </head> 
   <body>
     <p src="navbar1.png" type="image/png" usemap="#map1"> 
       <map id="map1">
         <nl>
           <label>Navigate the site:</label>
           <li href="guide.html" shape="rect" coords="0,0,118,28">
           Access Guide</li> 
           <li href="shortcut.html" shape="rect" coords="118,0,184,28">
           Go</li> 
           <li href="search.html" shape="circle" coords="184,200,60">
           Search</li>
           <li href="top10.html" shape="poly" coords="276,0,276,28,100,200,50,50,276,0">
           Top Ten</li>
         </nl>
       </map> 
      </p>
   </body>
</html> 

>>9 仕様案より

メモ

[5] coords Property (A, AREA) (2007-05-02 10:44:26 +09:00 版) http://msdn2.microsoft.com/en-us/library/ms533695.aspx (名無しさん)

[6] >>5

For a objects, you must set the value of this property before you can retrieve it. This satisfies the requirements of World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 World Wide Web link. The page author is responsible for implementing the functionality defined in HTML 4.0 World Wide Web link for a objects, if desired.

意味がわからない。 (名無しさん 2007-05-02 01:49:01 +00:00)

[7] Re: Image maps: should we drop <a coords="">? (Ian Hickson 著, 2007-08-06 21:22:19 +09:00 版) http://permalink.gmane.org/gmane.org.w3c.whatwg.discuss/11585

Regarding <a coords="">, I don't think it's used any more now than when I decided not to include it in HTML5, so I'm still of the opinion that not including it is a good thing.

[8] The SMIL 3.0 Linking Modules ( 版) http://www.w3.org/TR/2008/REC-SMIL3-20081201/smil-extended-linking.html#adef-coords

メモ

[11] [whatwg] Image maps: should we drop <a coords="">? ( ( 版)) http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2005-April/003508.html

[12] Revamp coords parsing to be more compatible and less insane · whatwg/html@ead6cfe ( 版) https://github.com/whatwg/html/commit/ead6cfe392d338b66ed85fa84855061fd0990431

[13] Google Maps JavaScript API V3 Reference  |  Google Maps JavaScript API  |  Google Developers ( ()) https://developers.google.com/maps/documentation/javascript/reference?csw=1#MarkerShape

Type:  Array<number>

The format of this attribute depends on the value of the type and follows the w3 AREA coords specification found at http://www.w3.org/TR/REC-html40/struct/objects.html#adef-coords.

The coords attribute is an array of integers that specify the pixel position of the shape relative to the top-left corner of the target image. The coordinates depend on the value of type as follows:

  - circle: coords is [x1,y1,r] where x1,y2 are the coordinates of the center of the circle, and r is the radius of the circle.

  - poly: coords is [x1,y1,x2,y2...xn,yn] where each x,y pair contains the coordinates of one vertex of the polygon.

  - rect: coords is [x1,y1,x2,y2] where x1,y1 are the coordinates of the upper-left corner of the rectangle and x2,y2 are the coordinates of the lower-right coordinates of the rectangle.

[14] Editorial: always state invalid value default (GloverDonovan著, ) https://github.com/whatwg/html/commit/7e941ae96b264d4743ea0afac00c3b3209ab0cde