HyperText Markup Language/Tag List/a

The anchor element (a) is used to define anchors, or hyperlinks. You can use it to refer to other pages with the href attribute (Hyperlink Reference).

Example

edit
<a href="http://en.wikibooks.org/" accesskey="w" hreflang="en" title="Click here for very good books">Wikibooks</a>

Strict, Transitional and Frameset, for both HTML 4 and XHTML 1.0.

a is an inline element.

Optional attributes

edit

charset

edit

This attribute allows you to specify the character encoding of the target location

coords

edit

href

edit

With the href attribute you specify the destination of the hyperlink, in other words, the page a visitor will be sent to when he clicks the link.

hreflang

edit

This attribute allows you to specify the language of the target page.

name

edit

This allows you to specify a name for the hyperlink, for use as a bookmark. Note that in XHTML, you should use the id attribute.

Allows you to specify the relation of the current to the target page. In other words, what the target page is, Possible values are alternate, appendix, bookmark, chapter, contents, copyright, designates, glossary, help, index, next, prev, section, start, stylesheet and subsection.

Allows you to specify the relation of the target page to the current page. In other words, what the current page is. This should be the same for all hyperlinks in the current page. For possible values, see rel above.

shape

edit

target

edit

This attribute can only be used in transitional and frameset XHTML documents. It is used to tell the browser where to open the targeted URL. The user has Four options to choose from:

  • _blank: The URL will open in a new window.
  • _parent: Will open in the parent frameset.
  • _self: Will open in the same window/tag as it was clicked on.
  • _top: Will open in the full body window.

type

edit

This lets you specify the Multipurpose Internet Mail Extensions type of the targeted URL.

Standard attributes

edit

Notes

edit

In Microsoft Internet Explorer, this is the only element on which the CSS pseudo-class selector hover works.

More info

edit

The <a> tag on W3Schools