Visit tutorialpro.org! ``` --- ## Browser Support All major browsers support the `` tag. --- "> Visit tutorialpro.org! ``` --- ## Browser Support All major browsers support the `` tag. --- " />
Easy Tutorial
❮ Att Meter Optimum Att Colgroup Charoff ❯

HTML <a> Tag

Example

Link to tutorialpro.org:

<a href="https://www.tutorialpro.org">Visit tutorialpro.org!</a>

Browser Support

All major browsers support the <a> tag.


Tag Definition and Usage

The <a> tag defines a hyperlink, which is used to link from one page to another.

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

The default appearance of links in all browsers is:


Tips and Notes

Tip: If the href attribute is not present, the <a> tag is not a hyperlink.

Tip: By default, the linked page is displayed in the current browser window. Unless you specify another target.

Tip: Use CSS to style links.


Differences Between HTML 4.01 and HTML5

In HTML 4.01, the <a> tag could be either a hyperlink or an anchor. In HTML5, the <a> tag is a hyperlink, but if it has no href attribute, it is merely a placeholder for a hyperlink.

HTML5 has some new attributes and does not support some HTML 4.01 attributes.


Attributes

Attribute Value Description
charset char_encoding Not supported in HTML5. Specifies the character encoding of the target URL.
coords coordinates Not supported in HTML5. Specifies the coordinates of the link.
download New filename Specifies that the target will be downloaded when a user clicks on the hyperlink.
href URL Specifies the URL of the page the link goes to.
hreflang language_code Specifies the language of the linked document. Used only if the href attribute is present.
media New media_query Specifies what media/device the linked document is optimized for. Default value: all. Used only if the href attribute is present.
name section_name Not supported in HTML5. Specifies the name of an anchor.
rel alternate <br>author <br>bookmark <br>help <br>license <br>next <br>nofollow <br>noreferrer <br>prefetch <br>prev <br>search <br>tag Specifies the relationship between the current document and the linked document. Used only if the href attribute is present.
rev text Not supported in HTML5. Specifies the relationship between the linked document and the current document.
shape default <br>rect <br>circle <br>poly Not supported in HTML5. Specifies the shape of a link.
target _blank <br>_parent <br>_self <br>_top <br> framename Specifies where to open the linked document. Used only if the href attribute is present. _blank: Opens the linked document in a new window or tab. <br>_parent: Opens the linked document in the parent frame. <br>_self: Opens the linked document in the same frame as it was clicked (this is default). <br>_top: Opens the linked document in the full body of the window.
type New MIME_type Specifies the MIME type of the linked document. Used only if the href attribute is present. <br>Note: MIME = Multipurpose Internet Mail Extensions.

Global Attributes

The <a> tag supports HTML's global attributes.


Event Attributes

The <a> tag supports HTML's event attributes.


Try It Yourself - Examples

Create a Hyperlink Link an Image

Open Link in New Browser Window

Create Email Link

Create Email Link 2

Jump to Different Parts of the Same Page Using Anchors


Related Articles

HTML Tutorial: HTML Links

HTML DOM Reference: Anchor Object

❮ Att Meter Optimum Att Colgroup Charoff ❯