HTML/Elements/map

From W3C Wiki
< HTML‎ | Elements
Jump to: navigation, search

<map>

The <map> element, in conjunction with any area element descendants, defines an image map.

Point

  • An image, in the form of an img element or an object element representing an image, may be associated with an image map (in the form of a map element) by specifying a usemap attribute on the img or object element. [Example A]


HTML Attributes

  • name = name of map
    Gives the map a name so that it can be referenced.
    The attribute must be present and must have a non-empty value with no space characters.
    The value of the name attribute must not be a compatibility-caseless match for the value of the name attribute of another map element in the same document.
    If the id attribute is also specified, both attributes must have the same value.


See also global attributes.


Example

Example A

[try it]:

<p>
  Please select a shape:
  <img src="shapes.png" usemap="#shapes"
       alt="Four shapes are available: a red hollow box, a green circle, a blue triangle, and a yellow four-pointed star.">
  <map name="shapes">
    <area shape="rect" coords="50,50,100,100"> <!-- the hole in the red box -->
    <area shape="rect" coords="25,25,125,125" href="red.html" alt="Red box.">
    <area shape="circle" coords="200,75,50" href="green.html" alt="Green circle.">
    <area shape="poly" coords="325,25,262,125,388,125" href="blue.html" alt="Blue triangle.">
    <area shape="poly" coords="450,25,435,60,400,75,435,90,450,125,465,90,500,75,465,60"
        href="yellow.html" alt="Yellow star.">
  </map>
</p>

Map01.png

HTML Reference

The HTML5 specification defines the <textarea> element in 4.10.13 The textarea element.