HTML Anchor

  • <a> </a> tags are called Anchor tags.
  • They used to define hyper links in html.
  • We can hide a link in a text or image. So that when we click that image, it will redirect us to the link.

Syntax :


  <a href="url" target="_self" >link text</a>
           

The text/image we want to show instead of link is specified between <a> </a> tags.

We have two attributes for Anchors:

  • herf
  • target

Let's have a look at each of them :

herf :


This attribute used to specify the link.

We can also specify an email adress using mailto keyword in this attribute.



  <a href="mailto: email id" >Send email</a>

           

This will yield the following result:

target :


This attribute used to specify how the link will have displayed.

Values of target attribute :

_self :
- open the link it was clicked in the same window or tab.
default Value when absence of target attribute.
_blank :
- open the link in a new window/tab.
_parent :
- open the link in the parent frame.
_top :
- open the link in the full body window.