<a>...</a>

HTML4 HTML5

The <a> tag defines a hyperlink embedded in a document — a link to another document or another location within the same document. Hyperlinks are considered a key element of hypertext documents, and the <a> tag defining them is a crucial element of HTML.

Both opening and closing tags are required.

Attributes:

charset="..." - Character encoding of the linked document. Not available in HTML5.

coords="..." - Area occupied in the document by the attached resource (in pixels or percentages). Not available in HTML5.

download="filename" - Specifies that the linked file should be downloaded when clicked.

href="..." - URL address of the attached resource.

hreflang="..." - Specifies the language of the linked document.

media="..." - Specifies the target device for document display (screen, paper, projection, braille, speech, all).

name="..." - Link name. Not available in HTML5.

ping="..." - Space-separated URLs to which POST notifications will be sent when the user clicks the link.

referrerpolicy="..." - Specifies whether and when to send referrer information (no-referrer, no-referrer-when-downgrade, origin, origin-when-cross-origin, unsafe-url).

rel="..." - (alternate, author, dns-prefetch, help, icon, license, next, pingback, preconnect, refetch, preload, prerender, prev, search, stylesheet) Specifies the relationship between the current and linked document. Required attribute.

rev="..." - Specifies the reverse relationship between the linked and current document. Not available in HTML5.

shape="..." - Specifies the shape of the attached resource (default, rect, circle, poly). Not available in HTML5.

type="..." - Specifies the media type of the linked document.

target="..." - Default location to open the linked document (_blank - open in the same browser window/frame, _parent - open in a new window, _self - open in the parent window/frame, _top - open in the full body of the window (replace all frames)).

Example

<a href="http://alg24.com">Welcome to the website dedicated to programming and algorithms.</a>

The browser will interpret this code as follows: