Hypertext Reference (href) attribute

Posted by admin | Posted in HTML Tutorial | Posted on 11-08-2010-05-2008

0

The href attribute in an anchor tag defines a reference, an address that the link refers to. Basically this is where the user will be taken if they click this link.

Hypertext references can be Internal, Local, or Global.

·           Internal – Links to the current page

in the href attribute we give the name of the anchor we need to link to in our page, preceeded by a hash (#)

·           Local – Links to other pages within your domain

in the href attribute we give a relative address of our own domain

·           Global – Links to other domains outside of your site

in the href attribute we provide the full URL of the web page we are making a link to.

Example:

Internal – href=”#anchorname”

Local – href=”../pics/picturefile.jpg”

Global – href=”http://www.xyz.com/”

Target Attribute

The target attribute defines where to open the linked document or page., ie on the same page or on a new page or in some frame if frmaes are used.

The code below will open the document in a new browser window:

Example:

  • <a href=”http://www.xyz.com/”
  • target=”_blank”>Visit XYZ!</a>

Example:

_blank

_self”

opens the page in a blank window

Loads the new page in current window

_parent” Loads new page into a frame that is superior to where the link lies
_top” Loads new page into the current browser window, cancelling all frames

Write a comment

Twitter Users
Enter your personal information in the form or sign in with your Twitter account by clicking the button below.