HTML a

From Htmlpedia
Jump to: navigation, search

HTML Element A

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.

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>

Attributes

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:
  • rect: left-x, top-y, right-x, bottom-y.
  • circle: center-x, center-y, radius. Note. When the radius value is a percentage value, user agents should calculate the final radius value based on the associated object's width and height. The radius should be the smaller value of the two.
  • poly: x1, y1, x2, y2, ..., xN, yN. The first x and y coordinate pair and the last should be the same to close the polygon. When these coordinate values are not the same, user agents should infer an additional coordinate pair to close the polygon.

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:
  • default: Specifies the entire region.
  • rect: Define a rectangular region.
  • circle: Define a circular region.
  • poly: Define a polygonal region.
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

Standard Attributes

id, class, title, style, dir, lang

Event Attributes

onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup


Tags in Tag

  • Fontstyle

TT, I, B, BIG, SMALL

  • 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


References


Back to HTML Elements