From http://www.w3schools.com (Copyright Refsnes Data)
The <a> tag defines a hyperlink, which is used to link from one page to another.
In HTML 4.01, the <a> tag could be either a hyperlink or an anchor. This was determined by the href attribute. In HTML 5, the <a> tag is always a hyperlink, but if it has no href attribute, it is only a placeholder for a hyperlink.
HTML 5 has some new attributes, and some HTML 4.01 attributes are no longer supported.
Tip: A linked page is normally displayed in the current browser window, unless you specify another target.
| Source | Output |
|---|---|
|
<p>Linking to W3Schools: <p> |
Linking to W3Schools: W3Schools Opening W3Schools a new browser window: W3Schools |
| Attribute | Value | Description | 4 | 5 |
|---|---|---|---|---|
| charset | character_encoding | Deprecated. Specifies the character encoding of the target URL | 4 | |
| coords | if shape="rect" then if shape="circ" then if shape="poly" then |
Deprecated. Specifies the coordinates appropriate to the shape attribute to define a region of an image for image maps | 4 | |
| href | URL | The target URL of the link | 4 | 5 |
| hreflang | language_code | Specifies the base language of the target URL. Use only if the href attribute is present | 4 | 5 |
| media | media query | Specifies the mediatype of the target URL. Default value: all. Use only if the href attribute is present | 5 | |
| name | section_name | Deprecated. Names an anchor. Use this attribute to create a bookmark in a document. Not supported. Use id instead. | 4 | |
| ping | URL |
Space separated list of URL's that gets notified when a user follows the hyperlink. Use only if the href attribute is present |
5 | |
| rel | alternate archives author bookmark contact external feed first help icon index last license next nofollow noreferrer pingback prefetch prev search stylesheet sidebar tag up |
Specifies the relationship between the current document and the target URL. Use only if the href attribute is present | 4 | 5 |
| rev | alternate designates stylesheet start next prev contents index glossary copyright chapter section subsection appendix help bookmark |
Deprecated. Specifies the relationship between the target URL and the current document | 4 | |
| shape | rect rectangle circ circle poly polygon |
Deprecated. Defines the type of region to be defined for mapping in the current area tag. Used with the coords attribute. | 4 | |
| target | _blank _parent _self _top |
Where to open the target URL. Use only if the href attribute is present
|
4 | 5 |
| type | mime_type | Specifies the MIME (Multipurpose Internet Mail Extensions) type of the target URL. Use only if the href attribute is present | 4 | 5 |
| class, contenteditable, contextmenu, dir, draggable, id, irrelevant, lang, ref, registrationmark, tabindex, template, title |
For a full description, go to Standard Attributes in HTML 5.
| onabort, onbeforeunload, onblur, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress, onkeyup, onload, onmessage, onmousedown, onmousemove, onmouseover, onmouseout, onmouseup, onmousewheel, onresize, onscroll, onselect, onsubmit, onunload |
For a full description, go to Event Attributes in HTML 5.
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.
From http://www.w3schools.com (Copyright Refsnes Data)