a tag (XHTML 1.0)

hyperlinks (anchor tag)

Topics

Hyperlinking is likely one of the single most important features of the World Wide Web. A hyperlink is created with the <A> tag, and in it's most basic form, it only requires a single attribute, the href attribute.

For instance, a simple link tag would look like this:

<a href="http://www.htmlpedia.net/">Visit htmlpedia.net</a>

And the result would look like this in the browser:

Visit htmlpedia.net

Using the title attribute

The title attribute can be used to give more information about the destination of the link. The text will be shown when the user hovers the mouse over links in most modern browsers. Here's an example:

<a href="http://www.htmlpedia.net/" title="htmlpedia.net has the most comprehensive HTML reference online!">Visit htmlpedia.net</a>

To see how it looks, hover your mouse over this link:

Visit htmlpedia.net

Attributes

Attribute Deprecated Required Description
accesskey  accessibility key character 
charset  char encoding of linked resource 
class  space-separated list of classes 
dir  direction for weak/neutral text 
href  URI for linked resource 
hreflang  language code 
id  document-wide unique id 
lang  language code 
nameX named link end 
rel  forward link types 
rev  reverse link types 
style  associated style info 
target  render in this frame 
title  advisory title 
type  advisory content type 

Events

Event Description
onblurthe element lost the focus 
onclicka pointer button was clicked 
ondblclicka pointer button was double clicked 
onfocusthe element got the focus 
onkeydowna key was pressed down 
onkeypressa key was pressed and released 
onkeyupa key was released 
onmousedowna pointer button was pressed down 
onmousemovea pointer was moved within 
onmouseouta pointer was moved away 
onmouseovera pointer was moved onto 
onmouseupa pointer button was released 



© htmlpedia.net 2008 - 2012