Skip to content
Related Articles

Related Articles

Improve Article

HTML <a> Tag

  • Difficulty Level : Basic
  • Last Updated : 04 Feb, 2021

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 values: The anchor tag contains many attributes which are listed below: 

  • charsets: This attribute is used to specifies the character-set. It is not supported by HTML 5.
  • download: It is used to specify the target link to download when the user clicks.
  • hreflang: It is used to specify the language of the linked document.
  • media: It is used to specify the linked media.
  • coords: It is used to specify the coordinate of links. It is not supported by HTML 5.
  • name: It is used to specify the anchor name. It is not supported by HTML 5 you can use the global id attribute instead.
  • rel: It is used to specify the relation between the current document and the linked document.
  • shape: It is used to specify the shape of the link. It is not supported by HTML 5.
  • type: It is used to specify the type of links.
  • target: It specifies the target link.
  • rev: It is used to specify the relation between the linked document and the current document. It is not supported by HTML 5.

Example 1: 

html




<!DOCTYPE html>
<html>
  <body>
    <h1>
      Welcome to
      <a href="https://www.geeksforgeeks.org/">
        GeeksforGeeks
      </a>
    </h1>
    <h2>This is anchor Tag</h2>
  </body>
</html>

Output: 



Example 2: 

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

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




My Personal Notes arrow_drop_up
Recommended Articles
Page :