Skip to content
Related Articles

Related Articles

Improve Article

HTML <a> Tag

  • Difficulty Level : Basic
  • Last Updated : 21 Sep, 2021

Example: In this example, GeeksforGeeks HTML Tutorial page will open when you click on GeeksforGeeks HTML Tutorial.

HTML




<!DOCTYPE html>
<html>
<body>
    
  <h2>Welcome to GeeksforGeeks HTML Tutorial</h2>
     GeeksforGeeks HTML Tutorial
  </a>
  
</body>
  
</html>

Output:

The <a> tag (anchor tag) in HTML is used to create a hyperlink on the webpage. This hyperlink is used to link the webpage to other webpages. It’s either used to provide an absolute reference or a relative reference as its “href” value.

Syntax: 



<a href = "link"> Link Name </a>

Attribute: The anchor tag contains many attributes which are listed below.

Example 1: In this example we simple redirect from the GeeksforGeeks to the Geeksforgeeks page.

HTML




<!DOCTYPE html>
<html>
  
<body>
  <h1>
    Welcome to
      GeeksforGeeks
    </a>
  </h1>
  <h2>This is anchor Tag</h2>
</body>
  
</html>

Output: 

Example 2: In this example we will use an image to redirect to the Geeksforgeeks page.

HTML




<!DOCTYPE html>
<html>
<body>
  
  <p>Click on the image to open web page.</p>
  <!-- anchor tag starts here -->
    <img src=
    width="300" height="250" />
  </a>
  <!-- anchor tag ends here -->
</body>
  
</html>

Output: 
 

Supported Browsers: 

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari
  • Edge

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :