HTML <a> Tag

Advertisements


Description

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

Example

<!DOCTYPE html>
<html>
<head>
<title>HTML a Tag</title>
</head>
<body>
<p>
This is a link to <a href="http://www.amrood.com">AMROOD.com</a>
</p>
</body>
</html>

This will produce following result:

This is a link to AMROOD.com

Global Attributes

This tag supports all the global attributes described in - HTML Attribute Reference

Specific Attributes

The HTML <a> tag also supports following additional attributes:

AttributeValueDescription
charset character_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.
download html-5filenameThis downloads the target when user clicks on the hyperlink.
href URLSpecifies the URL of a page or the name of the anchor that the link goes to.
hreflang language_codeLanguage code of the destination URL.
media html-5media_queryIt specifies what media the linked document is optimized for
name section nameMarks an area of the page that a link jumps to.
rel alternate
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.
rev alternate
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.
shape rect 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
type html-5mime_typeSpecifies the MIME (Multipurpose Internet Mail Extensions) type of the target URL

Event Attributes

This tag supports all the event attributes described in - HTML Events Reference

Browser Support

ChromeFirefoxIEOperaSafariAndroid
YesYesYesYesYesYes

html_tags_reference.htm