All TalkersCode Topics

Follow TalkersCode On Social Media

devloprr.com - A Social Media Network for developers Join Now ➔

Anchor Tag In HTML With Example

Last Updated : Mar 11, 2024

Anchor Tag In HTML With Example

In this tutorial we will show you the solution of anchor tag in HTML with example, in HTML, as we know there are many tags that are used in html to make a webpage or website.

Also, to make a website we have to link many webpages together, which is done with the help of anchor tag.

Anchor tag is not only used to link webpages, but it also used to create a link between html files, images, audio files, videos files etc.

Therefore, anchor tag is used to create a link between files or to link html files to other files.

Step By Step Guide On Anchor Tag In HTML With Example :-

As, anchor tag is used to link files each other. There are many attributes that are used under this tag. If you want to know about its attributes then you must visit to our webpage, in which we define about the attributes of anchor tags.

Now, anchor tag is used to create a link between many types of files. Also, you are able to use this tag, anywhere in body of webpage.

But for this here you have to create a tag this a used to represent anchor in html codes.

So a tag is used with its angle brackets. It is a paired tag and the text which is written between these tags is displayed on web browser.

<!DOCTYPE html>
      <html>
        <head>
          <title> Title of the document<title>
</head>
<body>
   <a href="http://www.google.com">
        click here to open google
    </a>
    <br><br>
    <a href="image.jpeg">
        this is an image
    </a>
    <br><br>
    <a href="mailto:talkerscode@gmail.com">
        click here to mail
    </a>
    <br><br>
    <a href="tel:+919876543210">
        click here to call
    </a>
</body>
      </html>
  1. First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
  2. Secondly, the <html> tag is used to indicate the beginning of an HTML document.
  3. As above now <head> tag is used to contain information about web page. In this tag a <title> tag is used which helps us to specify a webpage title. Both <head> and <title> tags are Paired tags. So, both have </head> and </title> ending tags respectively.
  4. Thirdly, <body> tag is used to define the webpage body. All the contents to show on website are written here. Here, in body we create four anchor tag which are used as <a> in html code.
  5. After this we use anchor tag as link, that can work online or offline with some customization and after that we use it as link of image, email and phone also. You can also attach audios and videos with this tag.
  6. At last, the <body> and <html> tags are closed with </body> and </html> respectively.

Conclusion :-

In conclusion, here we can say that our html code is a perfect example of use of anchor tag in html. If you are a beginner and don’t know anything about html, css, etc.

Then you must learn from our articles because these are easy to understand and the pronunciation, written material is easy to remember. I hope his tutorial on anchor tag in HTML with example helps you.