HTML 5 <a> tag
Definition and Usage
The <a> tag defines a hyperlink, which is used to link from one page to
another.
Differences Between HTML 4.01 and HTML 5
In HTML 4.01 the <a> tag could be either a hyperlink, or an anchor. This was
determined if the href attribute was described or not.
In HTML 5 the <a> tag is 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.
Tips and Notes
Note: A linked page is normally displayed in the current browser
window, unless you specify another target.
Example
| Source |
Output |
|
<p>Linking to W3Schools:
<a href="http://www.w3schools.com">
W3Schools</a>
</p>
<p>
Opening W3Schools a new browser window:
<a href="http://www.w3schools.com"
target="_blank">W3Schools</a>
</p>
|
Linking to W3Schools:
W3Schools
Opening W3Schools a new browser window:
W3Schools
|
Attributes
- 4: indicates if the attribute is defined in HTML 4.01
- 5: indicates if the attribute is defined in HTML 5
| Attribute |
Value |
Description |
4 |
5 |
| charset |
character_encoding |
Deprecated. Specifies the character encoding of the target URL |
4 |
|
| coords |
if shape="rect" then
coords="left,top,right,bottom"
if shape="circ" then
coords="centerx,centery,radius"
if shape="poly" then
coords="x1,y1,x2,y2,..,xn,yn" |
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
- _blank - the target URL will open in a new window
- _self - the target URL will open in the same document as it was clicked
- _parent - the target URL will open in the parent document
- _top - the target URL will open in the full body of the window
|
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 |
Standard Attributes
| class, contenteditable, contextmenu, dir, draggable, id,
irrelevant, lang, ref, registrationmark, tabindex, template, title |
For a full description, go to Standard
Attributes in HTML 5.
Event Attributes
| 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.
Try-It-Yourself Demos
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.
 |
 |
 |
 |
|
The Ektron Intranet
lets you do everything you need to do on your corporate intranet and everything you want to do... all with just one application.
What can you do with the Ektron Intranet? |
 |
Navigate through content, documents, assets, colleagues and workgroups quickly and intuitively with enterprise search |
 |
Communicate with friends and colleagues with forums, message boards and corporate blogging using the new Social Networking Platform |

|
Utilize the extensive out-of-the box features or customize your site through Ektron CMS400.NET's open architecture |
 |
Promote collaboration in your organization through project workspaces where others can efficiently find information and work together |
 |
Author/edit content, manage navigation, menus, audit trails, workflow and approvals with the best in breed Content Management |
|
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
|
|
 |
TAKE THE VIDEO TOUR |
 |
or download a FREE TRIAL today. |
|