Tutorials Point


  HTML Home

  HTML Tags Reference
  Selected Reading

Copyright © 2014 by tutorialspoint



  Home     References     Discussion Forums     About TP  

HTML <a> tag




Advertisements

Function:

The HTML <a> tag is used for creating a hyperlink to either another document, or somewhere within the current document.

Difference between HTML and XHTML:

NONE

Example:

<p>
This is a link to  <a href="http://www.amrood.com">AMROOD.com</a>
</p>

This will produce following result:

This is a link to AMROOD.com

Online Practice:

To Become more comfortable - Do Online Practice

Attributes:

AttributeValueDescription
charsetcharacter_encodingDefines the character encoding of the linked document.
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"

Specifies the coordinates appropriate to the shape attribute to define a region of an image for image maps
hrefURLSpecifies the URL of a page or the name of the anchor that the link goes to.
hreflanglanguage_codeLanguage code of the destination URL
namesection nameMarks an area of the page that a link jumps to.
relalternate
designates
stylesheet
start
next
prev
contents
index
glossary
copyright
chapter
section
subsection
appendix
help
bookmark
Describes the relationship between the current document and the destination URI.
revalternate
designates
stylesheet
start
next
prev
contents
index
glossary
copyright
chapter
section
subsection
appendix
help
bookmark
Specifies the relationship between the target URL and the current document.
shaperect
rectangle
circ
circle
poly
polygon
Specifies the shape of the image map
target_blank
_parent
_self
_top

Where to open the target URL.

  • _blank - the target URL will open in a new window
  • _self - the target URL will open in the same frame as it was clicked
  • _parent - the target URL will open in the parent frameset
  • _top - the target URL will open in the full body of the window
typemime_typeSpecifies the MIME (Multipurpose Internet Mail Extensions) type of the target URL

Standard Attributes:

AttributeDescription
accesskeyAccess keys (or shortcut keys)
classDocument wide identifier
dirSpecifies the direction of the text
idDocument wide identifier
tabindexHelps determine the tabbing order when the user 'tabs' through the elements on the page.
titleSpecifies a title to associate with the element.
styleHelps to include inline casecadubf style sheet.
langSets the language code.

Event Attributes:

AttributeDescription
onfocusScript runs when the element gets focus
onblurScript runs when the element loses focus
onclickScript runs when a mouse click
ondblclickScript runs when a mouse double-click
onmousedownScript runs when mouse button is pressed
onmouseupScript runs when mouse button is released
onmouseoverScript runs when mouse pointer moves over an element
onmousemoveScript runs when mouse pointer moves
onmouseoutScript runs when mouse pointer moves out of an element
onkeypressScript runs when key is pressed and released
onkeydownScript runs when key is pressed
onkeyupScript runs when key is released

Printer Friendly

Advertisements


  

Advertisements