HTML a tag

## HTML Reference

HTML by Alphabet HTML by Function HTML Global Attributes HTML Events HTML Canvas HTML Audio/Video HTML Doctypes HTML Colornames HTML Colorpicker HTML Colormixer HTML Character Sets HTML ASCII HTML ISO-8859-1 HTML Symbols HTML URL Encode HTML Lang Codes HTTP Messages HTTP Methods Keyboard Shortcuts

## HTML Tags

<!--> <!DOCTYPE> <a> <abbr> <acronym> <address> <applet> <area> <article> <aside> <audio> <b> <base> <basefont> <bdi> <bdo> <big> <blockquote> <body> <br> <button> <canvas> <caption> <center> <cite> <code> <col> <colgroup> <command> <datalist> <dd> <del> <details> <dfn> <dialog> <dir> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <font> <footer> <form> <frame> <frameset> <head> <header> <h1> - <h6> <hr> <html> <i> <iframe> <img> <input> <ins> <kbd> <keygen> <label> <legend> <li> <link> <map> <mark> <menu> <meta> <meter> <nav> <noframes> <noscript> <object> <ol> <optgroup> <option> <output> <p> <param> <pre> <progress> <q> <rp> <rt> <ruby> <s> <samp> <script> <section> <select> <small> <source> <span> <strike> <strong> <style> <sub> <summary> <sup> <table> <tbody> <td> <textarea> <tfoot> <th> <thead> <time> <title> <tr> <track> <tt> <u> <ul> <var> <video> <wbr>

# HTML <a> Tag

« HTML Reference
<abbr> Tag »

## Example

A link to W3Schools.com:

<a href="http://www.w3schools.com">Visit W3Schools.com!</a>
Try it yourself »
(more examples at the bottom of this page)

## Browser Support

The <a> tag is supported in all major browsers.

## 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.

By default, links will appear as follows in all browsers:

- An unvisited link is underlined and blue
- A visited link is underlined and purple
- An active link is underlined and red

## Tips and Notes

Tip: The following attributes: download, hreflang, media, rel, target, and type cannot be present if the href attribute is not present.

Tip: A linked page is normally 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 always a hyperlink, but if it has no href attribute, it is only a placeholder for a hyperlink.

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

## Attributes

New : New in HTML5.

Attribute | Value | Description
--- | --- | ---
charset | char_encoding | Not supported in HTML5. Specifies the character-set of a linked document
coords | coordinates | Not supported in HTML5. Specifies the coordinates of a link
download New | filename | Specifies the hyperlink target to be downloaded
href | URL | Specifies the URL of the page the link goes to
hreflang | language_code | Specifies the language of the linked document
media New | media_query | Specifies what media/device the linked document is optimized for
name | section_name | Not supported in HTML5. Specifies the name of an anchor

rel

alternate
author
bookmark
help
license
next
nofollow
noreferrer
prefetch
prev
search
tag

Specifies the relationship between the current document and the linked document

rev | text | Not supported in HTML5. Specifies the relationship between the linked document and the current document
shape | default rect circle poly | Not supported in HTML5. Specifies the shape of a link
target | _blank _parent _self _top framename | Specifies where to open the linked document
type New | MIME_type | Specifies the MIME type of the linked document

## Global Attributes

The <a> tag also supports the Global Attributes in HTML.

## Event Attributes

The <a> tag also supports the Event Attributes in HTML.

## Try it Yourself - Examples

Create hyperlinks
How to create hyperlinks.

An image as a link
How to use an image as a link.

Open a link in a new browser window
How to open a link in a new browser window, so that the visitor does not have to leave your Web site.

Create a mailto link
How to link to a mail message (will only work if you have mail installed).

Create a mailto link 2
Another mailto link.

Using an anchor URL
How to use an anchor URL with an id attribute (the name attribute is not supported in HTML5).

## Related Pages

HTML tutorial: HTML Links

HTML DOM reference: Anchor object

« HTML Reference
<abbr> Tag »

## Your suggestion:

Your E-mail (optional):

Page address:

Description:

Close [X]

## Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

## WEB HOSTING

Best Web Hosting UK Reseller Hosting Wow! $5 SSD Hosting

## WEB BUILDING

Download XML Editor
FREE Website BUILDER FREE Website Creator

## WEB RESOURCES

Web Statistics Web Validation

## SHARE THIS PAGE