HTML area tag
Note: If you don't know what a tag is and/or how you must use it we recommend you to read our HTML tags and attributes tutorial that you can find in our HTML tutorials section.
The
HTML area tag defines a sector or shape of an image map. This sector can be linked to a resource or a bookmark (like a normal
HTML a tag).
The "id" attribute assigns an identifier to the associated element. This identifier must be unique in the document and can be used to refer to that element.
Example:
Code begin
<p id="paragraph1">This is the first paragraph named as paragraph1. To dynamically change its properties use this identifier.</p>Code end
The "class" attribute assigns a class name (or a list of class names separated by spaces) to the container element. It's used with style sheets and tells the browser the class to which the element is associated with. A class gives visual attributes to elements.
Example:
Code begin
<p class="references">This article is based on the book "Wind in the trees" by Jhon L. Brooks</p>
<p class="references important">This article is based on the book "Wind in the trees" by Jhon L. Brooks... and is more important than the one before.</p>Code end
Defines a visual style of this element. Is a better practice to define styles attributes in external style sheets grouping them in classes. Attributes in the "style" parameter must preserve this order "name : value" and be separated by a semi-colon.
If you're writing
XHTML code it's recommended not to use this attribute and try style sheet classes (with the "class" attribute).
Example:
Code begin
<p style="color: #0000FF; font-size: 12pt">This is a paragraph with a defined style</p>
<p>And this is another text without style.</p>Code end
Indicates a title for the element. Used to give a short description about the element that is usually shown as a "tool tip" when the user put the mouse pointer over the element.
Example:
Code |
View |
<a title="HTMLQuick.com" href="http://www.htmlquick.com">HTML code</a> |
HTML code |
Specifies the language of an element's content. The default value in "unknown".
When writing
XHTML code the syntax "xml:lang" represents a preferred alternative in XHTML 1.0 and a replacement in XHTML 1.1 (e.g., xml:lang="en").
Example:
Code begin
<p lang="en">This is a paragraph in english.</p>
<p lang="es">Este es un párrafo en español.</p>Code end
dir
Specifies the text direction of the element's contents and attribute values, as well as tables directionality. It has two possible values that are case insensitive:
- RTL: Right to left.
- LTR: Left to right.
Example:
Code begin
<q lang="he" dir="rtl">...a Hebrew quotation...</q>Code end
The "alt" attribute defines an alternate text designed to be a textual replacement for objects that are usually not supported by some browsers. It also serve as additional information for browsers that do support these objects (images, forms and applets). Browsers may display this text as a tool tip when the mouse is over the object.
This attribute is required when writing
XHTML code.
Example:
Code |
View |
<img width="88" height="31" src="http://www.htmlquick.com/img/links/button.jpg" alt="HTMLQuick link button" /> |
 |
href (uri)
Specifies the destination resource for the element. Commonly used to refer to pages in the same domain name or external pages.
Example:
Code |
View |
Link to page on this site: <a href="http://www.htmlquick.com/tutorials/links.html">Links in HTML tutorial</a><br /> Link to external site: <a href="http://www.w3.org">World Wide Web Consortium</a> |
Link to page on this site: Links in HTML tutorial
Link to external site: World Wide Web Consortium |
Specifies the name of the frame where the destination document should be loaded. Refer to the
frame-target type definition for further information.
Code begin
Open in a new window: <a href="http://www.w3c.org" target="_blank">WWW Consortium</a>
Open in a frame named "content" (frame must be present in the actual frameset): <a href="http://www.w3c.org" target="content">WWW Consortium</a>Code end
Specifies the position of this element in the tabbing order. The tabbing order defines the sequence with all the elements than can receive the focus. Users can navigate this sequence via keyboard (usually with the "tab" key).
Stablish a relationship between this element and a character key, allowing the user to activate it with that key (usually when used together with the "alt" key). The activation result depends on the actual element's nature. For links, this action automatically follows the link, and other elements simply get the focus.
shape
Specifies the form of a shape used to define an area. Values are case-insensitive and may be one of these:
- default: Specifies the entire region.
- rect: Define a rectangular region.
- circle: Define a circular region.
- poly: Define a polygonal region.
coords
Defines the coordinates and position of a shape. It's used together with the "shape" attribute, and the coordinates depend of the "shape" value:
- rect: left-x, top-y, right-x, bottom-y.
- circle: center-x, center-y, radius. If the radius is measured in percentage, its calculated as that percentage of the smaller size of the associated object.
- poly: x1, y1, x2, y2, ..., xN, yN. This defines a closed polygon. If you define an open polygon, the browser should close it by adding a segment from the first point to the last one.
Coordinates are relative to the top-left corner of the associated object. Each coordinate is of
length type and are separated by commas.
nohref
When set, this boolean attribute specifies that a region has no associated link. The value is case-insensitive.
Remember that boolean attributes must be defined as attr_name="attr_name" to be
XHTML code compatible.
Example:
Code begin
<area nohref shape="rect" coords="55,137,155,163">Code end
- onclick
- ondblclick
- onmousedown
- onmouseup
- onmouseover
- onmousemove
- onmouseout
- onkeypress
- onkeydown
- onkeyup
- onfocus
- onblur
See complete list and information about
events in HTML
Example of how areas are defined for an image map.
Code |
View |
<!-- In this image we define the areas that ar going to be linked. The areas 1 and 2 will link to the HTML tags reference, the areas 3 and 4 will link to the events reference and the areas 5 and 6 will link to the types reference. --> <img src="../../img/examples/nav1exp.jpg" alt="Navigation menu explanation" /> |
 |
An image map with links made with the HTML area tag.
Code |
View |
<map name="nav1" id="nav1"> <area alt="HTML tags" href="../tags.html" shape="circle" coords="50,50,39" /> <area href="../tags.html" alt="HTML tags" shape="rect" coords="31,49,189,81" /> <area alt="HTML events" href="../events.html" shape="circle" coords="155,165,39" /> <area href="../events.html" alt="HTML events" shape="rect" coords="55,137,155,163" /> <area alt="HTML types" href="../types.html" shape="circle" coords="75,250,39" /> <area href="../types.html" alt="HTML types" shape="rect" coords="107,240,153,260" /> </map> <img src="../../img/examples/nav1.jpg" usemap="#nav1" alt="Navigation menu" /> |
|