HTML <a> Tag
Description:
The <a> tag defines an anchor. An anchor can be used in two ways:
- To create a link to another document, by using the
href attribute
- To create a bookmark inside a document, by using the
name attribute
The <a> element is usually referred to as a link or a hyperlink.
The most important attribute of the <a> element is the href attribute, which indicates the link’s destination.
Specific Attributes:
| Attribute | Definition |
| name | Specifies an area of the page that a link jumps to. |
| href | Specifies the location of a Web resource, thus defining a link between the current element (the source anchor) and the destination anchor defined by this attribute. |
| hreflang | Specifies the base language of the resource designated by href and may only be used when href is specified. |
| type | Specifies the type of content at the link destination. |
| rel | Specifies the relationship from the current document to the anchor specified by the href attribute. |
| rev | Specifies a reverse between the destination URI and the current document. |
| charset | Specifies the character encoding of the resource designated by the link. |
Other Attributes:
| Attribute | Definition |
| accesskey | Specifies a keyboard shortcut to access an element. |
| dir |
Specifies the text direction for the content in
an element. Possible Values:
|
| class | Specifies a classname for an element. |
| coords | Specifies the coordinates of a link. |
| id | Specifies a unique id for an element. |
| lang | Specifies a language code for the content in an element. |
| tabindex | Specifies the tab order of an element. |
| target |
Specifies the target frame to load the page into. Possible Values:
|
| title | Specifies a title to associate with the element. Many browsers will display this when the cursor hovers over the element (similar to a "tool tip"). |
| shape |
Specifies the shape of a link. Possible Values:
|
| style | Specifies an inline style for an element. |
Example Code:
Example of the <a href="http://www.htmlportal.net/tags/a-tag.htm" target="_blank">a tag</a>, used in html.
Result
Example of the a tag, used in html.