Elements/a

From W3C Wiki

<a>

The <a> element represents a hyperlink.

HTML Attributes

  • name = ID
    Specifies that its a element is a named hyperlink, with the name given by the value of this attribute.
    The name attribute on the a element is obsolete. Consider putting an id attribute on the nearest container instead.
    Any string, with the following restrictions:
    • must be at least one character long
    • must not contain any space characters


  • href = URL potentially surrounded by spaces
    A URL that provides the destination of the hyperlink. If the href attribute is not specified, the element represents a placeholder hyperlink.


  • target = browsing-context name or keyword
    A name or keyword giving a browsing context for UAs to use when following the hyperlink.
    The target attribute on the a element was deprecated in a previous version of HTML, but is no longer deprecated, as it is useful in Web applications, particularly in combination with the iframe element.
    Any string that is either of the following:
    • a browsing-context name
    • any case-insensitive match for one of the following literal strings: "_blank", "_self", "_parent", or "_top".


  • rel = set of space-separated tokens
    A list of tokens that specify the relationship between the document containing the hyperlink and the destination indicated by the hyperlink.


  • hreflang = language tag
    The language of the destination of the hyperlink.
    A valid language tag, as defined in [BCP47].


  • media = media-query list
    The media for which the destination of the hyperlink was designed.
    A valid media query list, as defined in [MediaQueries].


  • type = MIME type
    The MIME type of the destination of the hyperlink.
    A string that identifies a valid MIME media type, as defined in [RFC2046].


See also global attributes.


Examples

Examples

[try it]

<p>
<a href="http://en.wikipedia.org/wiki/Cambera">Cambera</a>
is the capital city of Australia.
</p>


HTML Reference

The HTML5 specification defines the <a> element in 4.6.1 The a element.