CoderTools Web site

HTML Anchors / Links


Description


The anchor tag is used to create what is commonly known as a link. An Anchor tag can create a link to another page or to position in the html page.

Examples



For example:

A link to Yahoo

The code:

 <a href="http://www.yahoo.com">A link to Yahoo</a>


If you want a new browser window to appear when the user clicks on the link then you can use the same as above but with the addition of the target attribute:

For example:

A link to Yahoo

The code:

 <a target="_blank" href="http://www.yahoo.com">A link to Yahoo</a>


Attributes for <a>


Name Values Description
href url
Specifies the url of the destination
title text
the title of the target document
target name
_blank
_self
_parent
_top
the window or frame the linked to document should be displayed.
_blank opens a new browser window
accesskey a single character e.g. a Specifies an shorcut key used to access the link from the keyboard.
tabindex number Specifies the tab index. When a user presses the tab key the focus is moved to each element in the tabindex order. This is useful when there are many links as the user can tab through each link
name text
Used to create a named anchor. Specifies the name of a part of the document (a fragment). You can link to fragments using the href attribute by pre-pending # to the name
rel next
prev
head
toc
parent
child
index
glossary
Creates a relationship between the current page and the target page.
rev next
prev
head
toc
parent
child
index
glossary
The relationship from the target page back to the source page.

12/13/2017 11:01:05 PM
Terms Of Use | Privacy Statement | Copyright 2006-2015 © Independence Software LLP