Kumail.pk is a Free Platform of

Anchor Tag Links

The <a> HTML element (or anchor element), with its href attribute, creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URL can address. Content within each <a> should indicate the link’s destination. If the href attribute is present, pressing the enter key while focused on the <a> element will activate it.

Anchor Tag Links

Anchor Tag Links

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>  

Test it Now


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>  
Anchor Tag Links

About Us

Kumail.pk is a Free Platform of Education initiated by Syed Kumail Hassan Shah (Director GIT Education)

E-Certification