<a> HTML Tag

In this article I explain <a> tag in HTML..
  • 2697

Introduction

The <a> tag defines an anchor, and this tag is used to create the hyperlink either in the same document or in the another document. The <a>tag is usually refer to as a link or hyperlink. The most important attribute of the <a> element is the href attribute, which indicates the link's destination.

By default, links will appear as follows in all browsers:

  • An unvisited link is underlined and blue
  • A visited link is underlined and purple
  • An active link is underlined and red

HTML Attributes

Some of the HTML <a> tag's attributes are:

Attributes Description
href Specifies the URL of the page the link goes to
name Marks an area of the page that a link jumps to
type The type of content at the link destination
rel Specifies the relationship between the current document and the linked document
rev Specifies the relationship between the linked document and the current document
shape Specifies the shape of a link
target Specifies where to open the linked document
style Inline style(css)
lang Specifies a language code for the content in an element
class Specify the class name of the element
dir Specifies the text direction for the content in an element
title Specifies extra information about an element
id Specifies a unique id for an element
tabindex Specifies the tab order of an element

Lets take an example of <a> tag

In this example I take two html pages named page1.htm and page2.htm. If I click the link created in page1 then the page2 will open and if I click the link created in page2 then page1 is open.

The code for page1.htm
 

<html>

<head>

    <title></title>

</head>

<body>

    <h3>

        Hi Today I explain what is <a href="page2.htm" dir="rtl" shape="rect">HTML</a>and

        the use of HTML</h3>

</html>

 

The code for page2.htm

 

<html>

<head>

    <title></title>

</head>

<body>

    <h5>

        HTML is a Hyper Text Transfer Language which is used to crete the web page.The extension

        of HTML file is .html or .htm<a href="page1.htm">BACK>></a></h5>

</body>

</html>

 

Output

Hi Today I explain what is HTMLand the use of HTML

when I click the HTML link then

HTML is a Hyper Text Transfer Language which is used to crete the web page. The extension of HTML file is .html or .htmBACK>>

will open.

Ask Your Question 
 
Got a programming related question? You may want to post your question here
 
© 2018 DotNetHeaven. All rights reserved.