HTML <a> Tag - Anchor
The <a> tag is used to make a click able link to another page, bookmark on a page or email address.
Where/how To Use The <a> Tag
| Use in head or body section? | body |
| Inline or Block level tag? | Inline |
| HTML Tag Syntax? | <start tag>CONTENT</end tag> |
| XHTML Tag Syntax? | <start tag>CONTENT</end tag> |
Example
Code
Preview
Notes
'A' tag is commonly referred to as an anchor.
Use the "target" attribute to open pages accordingly (In a new page etc).
Also use the "target" attribute to link frames/iframes. (by id or name attribute on frame)
There are no differences between XHTML and HTML for this tag
Attributes for the a (anchor) tag
Attribute | Description | Value(s) | DOCTYPE |
|---|---|---|---|
Strict DOCTYPE Attributes |
|||
href | Destination URL | URL | Strict, Transitional and Frameset |
Character Label | Strict, Transitional and Frameset | ||
coords | The coords attribute is used on an image map to specify the area which is clickable on an image | If shape= circle or circ | Strict, Transitional and Frameset |
hreflang | Defines the overall language code for the target URL | Strict, Transitional and Frameset | |
name | Used to make a bookmark on a document. | user-defined-name | Strict, Transitional and Frameset |
rel | Describes how the target URL relates to the current document. | alternate | Strict, Transitional and Frameset |
rev | Describes the reverse relationship between the target URL and the current document. | alternate | Strict, Transitional and Frameset |
shape | This attribute is used on an image map. It defines the clickable shape. Use this attribute with the coords attribute. | circ | Strict, Transitional and Frameset |
type | Defines the MIME type of the target URL | MIME type | Strict, Transitional and Frameset |
Non-Strict DOCTYPE Attributes |
|||
target | Where or how to open the link | _blank | Transitional and Frameset |
Common attributes for the a(anchor) tag
Details for Common html Attributes.
Javascript Event attributes for the a(anchor) tag
onmousedown, onmouseup, onclick, ondblclick, onmouseover, onmouseout, onmousemove, onkeydown, onkeyup, onkeypress, onfocus, onblur
Details for Javascript Event Attributes.

