Loading...
HTML <a> Tag

HTML <a> Tag

In this tutorial, we will learn about anchor tag in HTML with the help of examples.


<a> Tag

Anchor tag <a> is used to create a hyperlink with another document or somewhere within the current document.

Syntax

<a href = "link">...Clickable Link..</a>

Note : We have to provide the complete link to the website or the ID of the element in that document in place of link in href attribute.

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Hyperlink</title>
  </head>
  <body>
    <a href = "www.algbly.com" target = "_blank">An HTML Link</a>
  </body>
</html>

Output

An HTML Link

Specific Attribute

Attribute Value Description
charset character_encoding Defines the character encoding of the linked document
coords For rectangular shape coords are left, top, right, bottom
For circular shape coords are centerx, centery, radius
For polygon shape coords are x1, y1, x2, y2, x3, y3...............xn, yn
Specifies the coordinates to define image map i.e. clickable region for hyperlink
download filename This downloads the target when user clicks on the hyperlink
href URL Specifies the URL of a page or the name of the anchor we want to hyperlink the document
hreflang language_code Language code of the destination URL
media media_query Specifies the type of media linked to the document
name section name Marks an area of the page that a link jumps to
rel alternate
author
bookmark
help
license
next
nofollow
noreferrer
prefetch
prev
search
tag
Describes the relation between the current document and the destination URL
rev alternate
designates
stylesheet
start
next
prev
contents
index
glossary
copyright
chapter
section
subsection
appendix
help
bookmark
Specifies the relation 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
Specifies 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 mime_type Specifies the MIME (Multipurpose Internet Mail Extensions) type of the target URL

Global Attribute

Anchor Tag support all the global attributes of HTML.


Event Attribute

Anchor Tag support all the event attributes of HTML.


Next Tutorial

We hope that this tutorial helped you develop better understanding of the concept of<a> tag in HTML.

Keep Learning : )

In the next tutorial, you'll learn about HTML abbr Tag.

- Related Topics