0% found this document useful (0 votes)
38 views2 pages

12.HTML Anchor Tag

The HTML <a> anchor tag defines a hyperlink to link web pages. The "href" attribute specifies the destination URL and is required. The "target" attribute opens the link in a new tab or frame when set to "_blank". Anchors are styled as underlined and change color when visited, active, or unvisited to indicate their link state. All major browsers support the anchor tag.

Uploaded by

Hashiim Tahir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views2 pages

12.HTML Anchor Tag

The HTML <a> anchor tag defines a hyperlink to link web pages. The "href" attribute specifies the destination URL and is required. The "target" attribute opens the link in a new tab or frame when set to "_blank". Anchors are styled as underlined and change color when visited, active, or unvisited to indicate their link state. All major browsers support the anchor tag.

Uploaded by

Hashiim Tahir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

HTML Anchor

HTML Anchor
The HTML anchor tag defines a hyperlink that links one page to another page. It can
create hyperlink to other web page as well as files, location, or any URL. The "href"
attribute is the most important attribute of the HTML a tag. and which links to
destination page or URL.

href attribute of HTML anchor tag


The href attribute is used to define the address of the file to be linked. In other words, it
points out the destination page.

The syntax of HTML anchor tag is given below.


<a href = "..........."> Link Text </a>

Let's see an example of HTML anchor tag.

1. <a href="second.html">Click for Second Page</a>

Specify a location for Link using target attribute


If we want to open that link to another page then we can use target attribute of <a> tag.
With the help of this link will be open in next page.

Example:
1. <!DOCTYPE html>
2. <html>
3. <head>
4. <title></title>
5. </head>
6. <body>
7. <p>Click on <a href="https://www.javatpoint.com/" target="_blank"> this-
link </a>to go on home page of JavaTpoint.</p>
8. </body>
9. </html>

Output:

1/2
Note:

The target attribute can only use with href attribute in anchor tag.
If we will not use target attribute then link will open in same page.

Appearance of HTML anchor tag


An unvisited link is displayed underlined and blue.

A visited link displayed underlined and purple.

An active link is underlined and red.

Supporting Browsers

Element Chrome IE Firefox Opera Safari

<a> Yes Yes Yes Yes Yes

2/2

You might also like