The Anchor Tag: <a> </a>

This tag is an indispensable part of the internet experience because it is used to create links. Links are about the most fundamental element of the web because linking is what brings the whole thing together. There are essentially three different types of links you can put on a web page:
  • Internal links to anchors on the current page using the name or id attribute.
  • Local links to pages within the current site using the href attribute pointing to a page on the site.
  • Global links to other pages elsewhere on the web.
  • Links

    A link can be created using text or images. Whatever is included within the anchor tags will be a clickable link to the target page. The target page is specified in the href attribute of the <a> tag. For example href="http://www.microsoft.com".

    Example

    This exampleto uses the word “here” to act as a link to google.
    Click <a href="http://www.google.com" target="_blank">here</a> to go to Google.
    Click here to go to Google.

    Attributes:

    Attribute Values Description
    charset character_encoding Specifies the character encoding of the target URL
    coords For image maps (three shapes):

    "rect"
    coords="left,top,right,bottom"

    "circ"
    coords="centerx,centery,radius"

    "poly"
    coords="x1,y1,x2,y2,..,xn,yn"

    Specifies coordinates for the shape attribute, defining a region on an image map
    href A URL The destination URL for the link
    hreflang language_code Indicates the language of the destination
    id id name An anchor name. For creating an internal reference within a document.
    name section name An anchor name. For creating an internal reference within a document.
    rel alternate
    designates
    stylesheet
    start
    next
    prev
    contents
    index
    glossary
    copyright
    chapter
    section
    subsection
    appendix
    help
    bookmark
    Specifies a relationship between the originating document and the destination
    rev alternate
    designates
    stylesheet
    start
    next
    prev
    contents
    index
    glossary
    copyright
    chapter
    section
    subsection
    appendix
    help
    bookmark
    Specifies a relationship between the destination and the originating document
    shape rect
    rectangle
    circ
    circle
    poly
    polygon
    Defines the type of region for mapping to an area tag. Use with the coords attribute.
    target _blank
    _parent
    _self
    _top

    Where to open the destination page.

    • _blank = new window
    • _self = the originating frame
    • _parent = the parent frameset
    • _top = the top level of the window
    type mime_type Specifies the MIME (Multipurpose Internet Mail Extensions) type of the destination