HTML | a Tag

The <a> tag in HTML is used to create a hyper-link on the webpage. This hyper-link is used to link the webpage to other webpages.

Syntax:

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

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

  • charset: 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 user click.
  • hreflang: It is used to specify the language of linked document.
  • media: It is used to specify the linked media.
  • coords: It is used to specify the coordinate of links.
  • name: It is used to specify the anchor name.
  • rel: It is used to specify the relation between current document and linked document.
  • shape: It is used to specify the shape of link.
  • type: It is used to specify the type of links.
  • target: It specify the target link.
  • rev: It is used to specify the relation between linked document and current document.

Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>anchor tag</title>
    </head>
      
    <body>
        <p>Welcome to 
            <a href = "https://www.geeksforgeeks.org/">
                GeeksforGeeks
            </a>
        </p>
    </body>
</html>                    

chevron_right


Output:



Welcome to GeeksforGeeks

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

Supported Browsers: The browser supported by <a> tag ate listed below:

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


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.