From Htmlpedia
Contents |
[edit]
HTML Element A
[edit]
Definition and Usage
The <a> tag defines an anchor.
There are two kinds of anchors:
- to link to another document or to a bookmark with the "href" attribute
- to create a bookmark with the "name" or "id" attribute.
[edit]
Examples
<p>Link to <a href="http://www.w3.org/">W3C website</a></p> <p><a name="bookmark"></a> This is a bookmark</p> <p>Link to a <a href="#bookmark">bookmark</a>"</p> <p>Link to a bookmark on another page "<a href="http://www.w3.org/TR/html4/struct/links.html#edef-A">12.2 The A element</a>"</p>
[edit]
Attributes
[edit]
Optional attributes
| Attribute | Value | Description | DTD |
|---|---|---|---|
| accesskey | a single character | Provides a method to add keyboard navigation shortcuts. (see more full description: accesskey) | HTML4 Strict Transitional Frameset XHTML1 Strict Transitional Frameset |
| charset | a space-separated list of character encodings, as per [RFC2045] | char encoding of linked resource | HTML4 Strict Transitional Frameset |
| coords | %Coords; | This attribute specifies the position and shape on the screen. The number and order of values depends on the shape being defined. Possible combinations:
Coordinates are relative to the top, left corner of the object. All values are lengths. All values are separated by commas. | HTML4 Strict Transitional Frameset |
| href | %URI; | This attribute 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 | HTML4 Strict Transitional Frameset |
| hreflang | a language code, as per [RFC1766] | This attribute specifies the base language of the resource designated by href and may only be used when href is specified | HTML4 Strict Transitional Frameset |
| name | CDATA | This attribute names the current anchor so that it may be the destination of another link. The value of this attribute must be a unique anchor name. The scope of this name is the current document. Note that this attribute shares the same name space as the id attribute | HTML4 Strict Transitional Frameset |
| rel | alternate designates stylesheet start next prev contents index glossary copyright chapter section subsection appendix help bookmark | This attribute describes the relationship from the current document to the anchor specified by the href attribute. The value of this attribute is a space-separated list of link types | HTML4 Strict Transitional Frameset |
| rev | alternate designates stylesheet start next prev contents index glossary copyright chapter section subsection appendix help bookmark | This attribute is used to describe a reverse link from the anchor specified by the href attribute to the current document. The value of this attribute is a space-separated list of link types | HTML4 Strict Transitional Frameset |
| shape | default rect circle poly | This attribute specifies the shape of a region. Possible values:
| HTML4 Strict Transitional Frameset |
| target | _blank _parent _self _top | Where to open the target resource | HTML4 Transitional Frameset |
| type | media type, as per [RFC2045] | MIME type of the target resource | HTML4 Strict Transitional Frameset |
[edit]
Standard Attributes
id, class, title, style, dir, lang
[edit]
Event Attributes
onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
[edit]
Tags in Tag
- Fontstyle
- Phrase
EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, ABBR, ACRONYM
- Special
A, IMG, OBJECT, BR, SCRIPT, MAP, Q, SUB, SUP, SPAN, BDO
- Form
INPUT, SELECT, TEXTAREA, LABEL, BUTTON
[edit]
