W3Schools
  home HOME Tutorials | References | Examples | Forum | About
Search W3Schools:

Full Overview

HTML5 Tags

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

Selected Reading
Web Statistics
Web Glossary
Web Hosting
Web Quality

W3Schools Tutorials
W3Schools Forum

Helping W3Schools

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.





Ektron CMS400.NET Ektron - What do you want your website to do?
The Ektron Intranet
Take the video tour

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?

Ektron

Navigate through content, documents, assets, colleagues and workgroups quickly and intuitively with enterprise search

Ektron

Communicate with friends and colleagues with forums, message boards and corporate blogging using the new Social Networking Platform

Ektron

Utilize the extensive out-of-the box features or customize your site through Ektron CMS400.NET's open architecture

Ektron

Promote collaboration in your organization through project workspaces where others can efficiently find information and work together

Ektron

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 TAKE THE VIDEO TOUR
Take the Video Tour or download a FREE TRIAL today.


Jump to: Top of Page or HOME or Printer Friendly Printer friendly page

W3Schools provides material for training only. We do not warrant the correctness of its contents. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.

Copyright 1999-2008 by Refsnes Data. All Rights Reserved.

Validate Validate W3C-WAI level A conformance icon W3Schools was converted to XHTML in December 1999