WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

HTML <a> Tag


Example

A connection to welookups.com:

<a href="http://www.welookups.com">Visit welookups.com!</a>
Try it yourself »

More "Attempt it Yourself" precedents below.


Definition and Usage

The <a> Tags define hyperlinks that are used to link from one page to another.

The most important attribute of the <a> element is the href attribute, which specifies the destination of the link.

In all browsers, the default appearance of links is as follows:

  • Unvisited links are underlined and blue
  • Visited links are underlined and purple
  • The active link is underlined and red


Browser Support

Element
<a> Yes Yes Yes Yes Yes Yes

Tips and Notes

Tip: If you do not use the href attribute, you cannot use the hreflang, media, rel, target, and type attributes.

Tip: The linked page is usually displayed in the current browser window, unless another target is specified.

Tip: Use CSS to change the style of your links.


Differences Between HTML 4.01 and HTML5

In HTML 4.01,<a> Tags can be either hyperlinks or anchors. In HTML5,<a> A tag is a hyperlink, but without the href attribute, it is just a placeholder for the hyperlink.

HTML5 has some new attributes, and some HTML 4.01 attributes are no longer supported.


Attributes

= New in HTML5.

Attribute Value Description
charset char_encoding HTML5 is not supported.
Specifies the character encoding of the target URL.
coords coordinates HTML5 is not supported.
Specifies the coordinates of the link.
download filename Specify download link
href URL Specifies the destination URL of the link
hreflang language_code Specifies the base language of the target URL. Only used if the href attribute is present.
media media_query Specifies the media type of the target URL. Default: all. Only used if the href attribute is present.
name section_name HTML5 is not supported. id attribute instead.
Specifies the name of the anchor.
rel alternate
author
bookmark
help
license
next
nofollow
noreferrer
prefetch
prev
search
tag
Specifies the relationship between the current document and the target URL. Only used if the href attribute is present.
rev text HTML5 is not supported.
Specifies the relationship between the target URL and the current document.
shape default
rect
circle
poly
HTML5 is not supported.
Specifies the shape of the link.
target _blank
_parent
_self
_top
framename
Specifies where to open the destination URL. Only used if the href attribute is present.
type media_type Specifies the media sort of the connected document

Global Attributes

The <a> tag additionally bolsters the Global Attributes in HTML.


Event Attributes

The <a> tag likewise underpins the Event Attributes in HTML.