English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The HTML <a> tag defines a hyperlink pointing to a URL or target in an HTML document. This tag is also commonly referred to as the <a> element.
Link to the Basic Tutorial Website :
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Basic Tutorial Website(oldtoolbag.com)</title> </head> <body> <a href="https://www.oldtoolbag.com">Visit the Basic Tutorial Website!</a>/a> </body> </html>Test and see ‹/›
IEFirefoxOperaChromeSafari
All mainstream browsers support the <a> tag.
The <a> tag defines a hyperlink, used to link from one page to another.
The most important attribute of the <a> element is the href attribute, which specifies the target 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
Active links are underlined and red
The HTML <a> element is located within the <body> tag.
Start with <a> and end with/The text between <a> and </a> will be displayed as hyperlink text (i.e., underlined text).
If you want the resource to open in a new window, please use the target =" _ blank" attribute. For example, you can write a hyperlink as follows: <a href="/examples/filename.html" target="_blank">Link to filename</a>
In HTML 4.01 In Chinese, the <a> tag can be both a hyperlink and an anchor. In HTML5 In Chinese, the <a> tag is a hyperlink, but if it does not have the href attribute, it is just a placeholder for a hyperlink.
HTML5 There are some new attributes and some HTML attributes are no longer supported. 4.01 attributes.
New : HTML5 new attributes in
Attribute | Value | Description |
---|---|---|
charset | char_encoding | HTML5 Not supported. Specifies the character encoding of the target URL. |
coords | coordinates | HTML5 Not supported. Specifies the coordinates of the link. |
downloadHTML5 | filename | Specifies the download link |
href | URL | Specifies the target URL of the link. |
hreflang | language_code | Specifies the base language of the target URL. Used only when the href attribute exists. |
mediaHTML5 | media_query | Specifies the media type of the target URL. Default value: all. Used only when the href attribute exists. |
name | section_name | HTML5 Not supported. Specifies the name of the anchor. |
pingHTML5 | list_of_URLs | Specifies a space-separated list of URLs for the specified URL, when the link is followed, the browser will send a ping request (backend). Usually used for tracking |
referrerpolicy | no-referrer no-referrer-when-downgrade origin origin-when-cross-origin unsafe-url | Specifies the specific push type |
rel | alternate author bookmark help license next nofollow noreferrer prefetch prev search tag | Specifies the relationship between the current document and the target URL. Used only when the href attribute exists. |
rev | text | HTML5 Not supported. Specifies the relationship between the target URL and the current document. |
shape | default rect circle poly | HTML5 Not supported. Specifies the shape of the link. |
target | _blank _parent _self _top framename | Specifies where to open the target URL. Used only when the href attribute exists. |
type HTML5 | MIME_type | Specifies the MIME type of the target URL. Used only when the href attribute exists. Note: MIME = Multipurpose Internet Mail Extensions. |
Support for the <a> tag Global attributes of HTML.
Support for the <a> tag HTML event attributes.
Image Links This example demonstrates how to use image links.
Link to a specified location within the current page This example demonstrates how to use bookmarks
Break Out of Frames This example demonstrates how to break out of frames, if your page is fixed within a frame.
Creating an email link This example demonstrates how to link to an email. (This example will only work after installing an email client program.)
Creating an email link 2 This example demonstrates a more complex email link.
Creating a phone link This example demonstrates creating a link that can make a phone call.
HTML Tutorial:HTML Links
HTML DOM Reference Manual: Anchor Object